Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CallableStatement

Status
Not open for further replies.

scohan

Programmer
Joined
Dec 29, 2000
Messages
283
Location
US
I want to set an oracle package variable from my java app, but I'm having trouble figuring out to code. I have this package:

CREATE OR REPLACE PACKAGE vars AS
userId varchar2(15);
END;
/

I want to set this userId like this from my java app:

begin vars.userId := <userid>; end;

I've trid the following code:

try {
CallableStatement stmt =
conn.prepareCall (&quot;{call begin vars.userId := 'testuser'; end;}&quot;);
stmt.execute ();

} catch (Exception e){
System.out.println(e.toString());
}

but I get the following exception:

java.sql.SQLException: ORA-01400: cannot insert NULL into (&quot;NOTE&quot;.&quot;NOTE_AUDIT&quot;.&quot;CHANGED_BY&quot;) ORA-06512: at &quot;NOTE.LOGNOTECHANGES&quot;, line 21 ORA-04088: error during execution of trigger 'NOTE.LOGNOTECHANGES'

Any ideas on how I need to code this? Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top