View Single Post
  #1 (permalink)  
Old July 12th, 2005, 09:22 AM
Rhea_Raksha Rhea_Raksha is offline
Registered User
 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax for bind variables in Pro*C

Hi,

I need to use bind variables in Pro*C. How do I use it? looking for syntax. PLEASE HELP. It's URGENT. Expert one-on-one doesn't talk about this.

Below is the cut-paste from TKPROF -:

update temp_table set PROCESSED_BY_LOAD='Y',
 country_determine_logic=:b0,date_modify=:b1
where
 rowid=CHARTOROWID(:b2)


call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 918 0.22 0.65 0 0 0 0
Execute 918 0.97 1.08 0 1395 9406 918
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 1836 1.19 1.73 0 1395 9406 918

Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 36 (RHEARAK)

Rows Row Source Operation
------- ---------------------------------------------------
 1 UPDATE
 1 TABLE ACCESS BY USER ROWID TEMP_TABLE


Rows Execution Plan
------- ---------------------------------------------------
 0 UPDATE STATEMENT GOAL: CHOOSE
 1 UPDATE OF 'TEMP_TABLE'
 1 TABLE ACCESS GOAL: ANALYZED (BY USER ROWID) OF 'TEMP_TABLE'

Please see that the parse count and execute count are the same .
So I thought of using bind variables. But I have not worked much on bind variables.

So am confused with the syntax. I tried few options but it's not working.
================================================== ==================
EXEC SQL
 UPDATE temp_table
 SET PROCESSED_BY_LOAD ='Y',
 country_determine_logic=:s_country_determine_logic ,
 date_modify=:s_sytem_date
 WHERE
 rowid = CHARTOROWID(: s_row_id);
================================================== ==================
s_country_determine_logic etc, are host variables.

As far as I know all host/indicator variables are bind variables. Please correct me if I am wrong and let me know the syntax.


Thanks in Advance,
Rhea