Home » Developer & Programmer » Precompilers, OCI & OCCI » Odd errors: ORA 1036, 1722
Odd errors: ORA 1036, 1722 [message #93632] Tue, 03 September 2002 01:44 Go to next message
Alan Powell
Messages: 2
Registered: September 2002
Junior Member
Using ProC (on HP-UP 11 with Oracle 8.1.7.4.0), the following code snippet gives me problems:

//----- snippet [[compressed for space purposes]]
int Ftn (sql_context context)
{
EXEC SQL BEGIN DECLARE SECTION;
char* db_file_id;
char* db_record_id;
int db_length;
struct sqlca sqlca;
EXEC SQL END DECLARE SECTION;

EXEC SQL CONTEXT USE :context;

db_file_id = "IFORMAT";
db_record_id = "HDR";
EXEC SQL WHENEVER SQLERROR DO ErrorFtn ("ERROR");
EXEC SQL WHENEVER SQLWARNING DO WarningFtn ("WARN");

EXEC SQL
SELECT length INTO :db_length FROM file_record
WHERE fk_fit_id = :db_file_id
AND fk_icr_type = :db_record_id;

if (sqlca.sqlcode ....)
//----- End snippet

Using it as above gives ORA-01036 (illegal variable name/number). Replacing the variables in the WHERE clause with hardcoded values (i.e. fk_fit_id = 'IFORMAT' AND fk_icr_type = 'HDR') gives ORA-01722 (invalid number).

The offending table is defined as
CREATE TABLE FILE_RECORD (
FK_ICR_TYPE VARCHAR2 (3) NOT NULL,
FK_FIT_ID VARCHAR2 (10) NOT NULL,
LENGTH NUMBER (9),
TEXT_VALIDATION CHAR (1),
DESCRIPTION VARCHAR2 (80),
--- constraints, etc. left out.
)

More bizarrely, i can select numeric fields from other tables using very similar code.

What on earth is happening?

BTW, i'm a newbie at ProC so be gentle <<grin>]]

Thanks
Re: Odd errors: ORA 1036, 1722 [message #93633 is a reply to message #93632] Tue, 03 September 2002 04:04 Go to previous messageGo to next message
Alan Powell
Messages: 2
Registered: September 2002
Junior Member
BTW, i was advised to use a local contect variable:

EXEC SQL BEGIN DECLARE SECTION;
sql_context ctx = context; // Added.
EXEC SQL END DECLARE SECTION;

EXEC SQL CONTEXT :ctx; // Changed.

Made no difference.
Re: Odd errors: ORA 1036, 1722 [message #94311 is a reply to message #93632] Sat, 17 July 2004 09:27 Go to previous message
Ganesh
Messages: 31
Registered: November 2000
Member
i am also encountring the same error.
If u got the solution . Plz mail me....
Previous Topic: Terminating the application when I execute sqlcxt in Pro*C/C+ Program in Unix
Next Topic: OCI with Hoard Scalable Memory Allocator
Goto Forum:
  


Current Time: Sat Aug 15 15:25:52 CDT 2020