Home » SQL & PL/SQL » SQL & PL/SQL » Object References
Object References [message #235633] Mon, 07 May 2007 08:54 Go to next message
gcurrie
Messages: 2
Registered: May 2007
Junior Member
Hi

I would like to know how I share objects.

I used the code below but PLSQL seems to make a copy of the instance rather than setting a reference to the object?

Any suggestions?

Thanks

CREATE OR REPLACE PROCEDURE TestObjectRefs IS


bankTransaction TRANSACTION; -- TRANSACTION is uer defined object
bt TRANSACTION;

BEGIN

bankTransaction := TRANSACTION( 1, 1000, 1 || 'X', 'Hello World' );
bt := bankTransaction;

bankTransaction.DESCRIPTION := 'Goodbye World';

-- expecting output below to be the same ?

dbms_output.put_line(bt.DESCRIPTION);
dbms_output.put_line(bankTransaction.DESCRIPTION);

EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END TestObjectRefs;
Re: Object References [message #235640 is a reply to message #235633] Mon, 07 May 2007 09:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, Oracle copies the values from the original record into the target ones.

Btw, using a reserved word (TRANSACTION) for your use is a very bad idea.

Regards
Michel
Re: Object References [message #235649 is a reply to message #235640] Mon, 07 May 2007 10:10 Go to previous message
gcurrie
Messages: 2
Registered: May 2007
Junior Member
yep i know "transaction"... used only to illustrate problem....

so is there no way to share objects then?

thanks
gordon
Previous Topic: Re: how can i PASS TABLE NAME AS PARAMETER IN PROCEDURE
Next Topic: URGNT PLZ WHAT'S WRONG
Goto Forum:
  


Current Time: Fri Dec 09 15:47:40 CST 2016

Total time taken to generate the page: 0.16549 seconds