Re: Again: Calling a stored procedure from PRO*C

From: John Gillespie <jgg_at_waldo.corte-madera.geoquest.slb.com>
Date: 8 Apr 1994 17:04:44 GMT
Message-ID: <2o42rc$fas_at_k2.San-Jose.ate.slb.com>


Page 5-26 of the PRO*C guide version 1.5 says to use PREPARE and EXECUTE of a string, so i think you need:

EXEC SQL BEGIN DECLARE SECTION;
         VARCHAR proc_name[255];
EXEC SQL END DECLARE SECTION;    strcpy(proc_name.arr,"Begin winkler.my_procedure; end;");  proc_name.len=strlen(proc_name.arr);  

 EXEC SQL PREPARE S1 FROM :proc_name;
 EXEC SQL EXECUTE S1;  Haven't tried it, but makes sense, since you have never been  able to pass a table name as a bind variable...

In article <1994Apr8.111401.13356_at_newsserver.rrzn.uni-hannover.de>, winkler_at_informatik.uni-hannover.de (Marcus Winkler) writes:
|> I want to call a stored procedure from a PRO*C program where the procedure's
|> name is known at runtime.
|>
|> I tried it this way:
|>
|> EXEC SQL BEGIN DECLARE SECTION;
|> VARCHAR proc_name;
|> EXEC SQL END DECLARE SECTION;
|>
|> strcpy(proc_name.arr,"my_procedure");
|> proc_name.len=strlen(proc_name.arr);
|>
|> EXEC SQL EXECUTE
|> BEGIN
|> winkler.proc_name;
|> END;
|> END-EXEC;
|>
|> where winkler is my uid.
|>
|> I can call my_procedure from SQLPLUS with EXECUTE my_procedure, but the
|> Precompiler tells me:
|> ERROR ... PLS-201: identifier 'winkler.proc_name' must be
|> declared.
|>
|> I am using Oracle 7. Even the sample program 9 in the supplement to the
|> Oracle precompiler guide version 1.5 does not work with the call:
|> EXEC SQL EXECUTE
|> BEGIN
|> calldemo.get_employees(....);
|> END;
|> END-EXEC;
|>
|> Who can help me ?
|>
|>
|>
Received on Fri Apr 08 1994 - 19:04:44 CEST

Original text of this message