Home » Developer & Programmer » Precompilers, OCI & OCCI » SQL select and C
SQL select and C [message #94254] Thu, 10 June 2004 02:26 Go to next message
Jordi Sole
Messages: 1
Registered: June 2004
Junior Member
I've found this way to execute a select in a C program

{
 struct sqlexd sqlstm;

 sqlstm.sqlvsn = 8;
 sqlstm.arrsiz = 1;
 sqlstm.stmt = "select count(distinct CODI_PLA) into :b0  from PSN_CONFIG_PL
A ";
 sqlstm.iters = (unsigned int  )1;
 sqlstm.offset = (unsigned int  )2;
 sqlstm.selerr = (unsigned short)1;
 sqlstm.cud = sqlcud0;
 sqlstm.sqlest = (unsigned char  *)&sqlca;
 sqlstm.sqlety = (unsigned short)0;
 sqlstm.sqhstv[[0]] = (unsigned char  *)&lNumPlans_CgCfg;
 sqlstm.sqhstl[[0]] = (unsigned int  )4;
 sqlstm.sqindv[[0]] = (         short *)0;
 sqlstm.sqharm[[0]] = (unsigned int  )0;
 sqlstm.sqphsv = sqlstm.sqhstv;
 sqlstm.sqphsl = sqlstm.sqhstl;
 sqlstm.sqpind = sqlstm.sqindv;
 sqlstm.sqparm = sqlstm.sqharm;
 sqlstm.sqparc = sqlstm.sqharc;
 sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}

Anyone could explain me the syntax? or a place where i could find some help or some user's guide?

 

Thank you, Jordi
Re: SQL select and C [message #94263 is a reply to message #94254] Wed, 23 June 2004 06:20 Go to previous messageGo to next message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
Hi,

I don't even want to start explaining the syntax to you. But if you really want to know, you can study the "Oracle Call Interface Programmer's Guide".

Luckily the Pro*C precomplier can generate these statements from high-level source. This is documented in the "Pro*C/C++ Precompiler Programmer's Guide".

Best regards.

Frank
Re: SQL select and C [message #94274 is a reply to message #94254] Mon, 28 June 2004 20:47 Go to previous message
Jai Vrat Singh
Messages: 205
Registered: September 2002
Location: Singapore
Senior Member
I think you got resutl from a .c file produced by the precompiler from a .pc file.

No one uses this structure directly to interact with databse. Instead, you write embedded Pro*C code and then precompile it wioth oracle precompiler, get a .c doe from that and then use it like an ordinary c program.

You can refer
http://www-db.stanford.edu/~ullman/fcdb/oracle/or-proc.html#whenever%20statement
Previous Topic: command to read readable string in a core file
Next Topic: Pro*c Include File
Goto Forum:
  


Current Time: Thu Mar 28 08:17:12 CDT 2024