Problem with embedded dynamic pl/sql in/out parameters

From: Cary B. O'Brien <cobrien_at_access3.digex.net>
Date: 19 Sep 1994 09:00:10 -0400
Message-ID: <35k20q$irc_at_access3.digex.net>


OK. I really tried to follow the example for method 4 for embedded sql (Oracle version 7). And it works, up to a point. But I still have some questions.

I am trying to call a stored procedure from C, using embedded sql. My program goes something like this:

  1. I do the EXE SQL PREPARE, with 'begin :rc := (pl/sql function call)end;' and get back a SQLDA * called bind_dp, which tells me the names and lengths of the placeholders. Note that the stored procedures have output and (sometimes) in/out parameters.
  2. I call EXEC SQL DECLARE to set up a cursor
  3. I put the values for the placeholders in the bind_dp->V[i], and lengths in bind_dp->L[i].
  4. I call EXE SQL OPEN C USING DESCRIPTOR bind_dp; which should execute my stored procedure. Sometimes it does, sometimes I get a value conversion error.
  5. Do a CLOSE

My questions are:

  1. When setting up the bind descriptor WHAT SHOULD THE LENGTH (bind_dp->L[i]) fields be? If they are set to the length of the input variable, the output variable (if longer) gets truncated (or I get a conversion error). If i set it to the actual length of the buffer, does my input variable get padded with spaces? If it is padded with spaces, does oracle care?
  2. How can I tell, for an arbitrary stored procedure call, if the parameters are input, output, or in/out?

Thanks In Advance

Cary O'Brien
cobrien_at_access.digex.net Received on Mon Sep 19 1994 - 15:00:10 CEST

Original text of this message