Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Calling SP from VB5.0 and returning a value
I'm trying to call a SP from VB5. The idea is to return the .nextval of a
sequence from the procedure after I insert a record. My SP Looks Like This:
(
in_BLOOD_TYPE_NAME in varchar2 default null, in_MODIFIED_BY in number default null, in_EDIT_FLAG in varchar2 default null,
SELECT SEQ_MAINT_BLOOD_TYPE_ID.nextval INTO out_BLOOD_TYPE_ID FROM user_sequences; insert into MAINT_BLOOD_TYPE
(
BLOOD_TYPE_ID, BLOOD_TYPE_NAME, TIMESTAMP, MODIFIED_BY, EDIT_FLAG ) values
(
out_BLOOD_TYPE_ID, in_BLOOD_TYPE_NAME, SYSDATE, in_MODIFIED_BY, in_EDIT_FLAG ); commit; EXCEPTION when others then rollback;
According to PL/SQL book, the passed value of the actual parameter is ignored if declared as 'OUT', as I have for out_BLOOD_TYPE_ID. Here's the VB code to call the SP:
Public conn As rdoConnection
rdoEngine.rdoEnvironments(0).CursorDriver = rdUseOdbc Set conn = rdoEngine.rdoEnvironments(0).OpenConnection("ODBCSOURCE", rdDriverNoPrompt, False, "uid=;pwd=", rdAsyncEnable)
BLOOD_TYPE_NAME = "Type AB+"
MODIFIED_BY = 1
EDIT_FLAG = "N"
SQL = "BEGIN ADDMAINT_BLOOD_TYPE('" & BLOOD_TYPE_NAME & "'," _
& MODIFIED_BY & ", '" & EDIT_FLAG & "', " & BLOOD_TYPE_ID & "); end;"
conn.Execute SQL
' SQL reads: BEGIN ADDMAINT_BLOOD_TYPE('Type AB+',1, 'N', 0); end;
I Get the following Error:
PLS-00363: expression '0' cannot be used as an assignment target.
According to PL/SQL Book, the Stored Procedure should reassign the formal parameter (out_BLOOD_TYPE_ID) to the Actual Parameter, supposedly BLOOD_TYPE_ID. What's Wrong?
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Thu Jun 04 1998 - 09:52:37 CDT