ORA-1036の解決方法

Pro*Cで開発していて、ORA-1036のエラーが出た場合の解決策(原文)


What does this block do? Does it contain WHENEVER statement? Are you using the USING clause?
There may be several possible reasons as to why you are getting this error:
1)make sure that teh input and output host variables are not the same
2)if you are using PREPARE statement, see if you are using error check properly
3)are you on Sun Solaris by chance? If so, there was a bug ..
4) from Metalink:
PROBLEM:
---------

An ORA-1036 error: "illegal variable name/number" is generated at runtime when
you have embedded SQL in your PRO*C application. This error message is a very misleading
one as it has to do with a precompiler flag which needs to be set.

This error will be generated if you port an application from a database that was
running an older version of PRO*C (V1.x) to a database running a newer version of PRO*C (V2.x).

SOLUTION:
---------

This problem is related to BUG #295686. The problem is caused by the precompiler
flag SQLCHECK. In V1.x of the PRO*C precompiler this flag was set to NONE, but in
the newer versions of PRO*C (V2.x) this flag needs to be set to SYNTAX.
The reasons for this are due to the changes in architecture and design of the newer version of the precompiler.

NOTE: If this flag is set incorrectly (SQLCHECK=NONE) an executable will still 
be generated which is runnable, and it will appear to run fine as long
as SQLCA.SQLCODE is not checked explicitly. However, when SQLCODE 
is checked, this very misleading ORA-1036 error is generated.
5) Metalink again:
Problem Explanation 
=================== 

Embedded SQL statement in PROC at run time getting 
ORA-1036.

Solution Explanation 
==================== 

WHhn getting an ORA-1036 "illegal variable name/number" at runtime on a PROC 
embedded SQL statement. Make sure the program variables match the table 
column types. 

i.e. varchar and varchar2 for character array 
number for long or doubles 
date for date 

Also, if they are concatinating || some table columns, they need to be of the 
same type. Character types don't mix with 
number or date types, one must use TO_CHAR() to convert a number or date type 
to a Character type.

Ora 1036 usally comes when one of the bind variables used in the sql is not found in the OS.
There may be two reasons.
1. You might have made some spelling mistake in the variable name [not column name]
2. OS might have faced some memory leak which causes this variable to disapear.
For the reason No. 2 you can overcome by giving entirly different variable name [YES it works!!!!] in all the places where u have used using & or && in the sql or : variables if in a pre compiled program. 


2002/07/19 担当:数値DB再構築/新企業基本

[戻る]