Home » SQL & PL/SQL » SQL & PL/SQL » Regarding query
Regarding query [message #194150] Thu, 21 September 2006 00:27 Go to next message
prasadrv
Messages: 2
Registered: September 2006
Location: delhi
Junior Member
HI Everybody,

1)Once defined, how long will a variable remain so in SQL*Plus?

Until the database is shut down

Until the instance is shut down
Until the statement completes
Until the session completes
2)
Re: Regarding query [message #194152 is a reply to message #194150] Thu, 21 September 2006 00:30 Go to previous messageGo to next message
sandeepk7
Messages: 137
Registered: September 2006
Senior Member

Perhaps it depends on the type of declaration.
Re: Regarding query [message #194160 is a reply to message #194152] Thu, 21 September 2006 01:29 Go to previous messageGo to next message
prasadrv
Messages: 2
Registered: September 2006
Location: delhi
Junior Member
1)Once defined, how long will a variable remain so in SQL*Plus?

Until the database is shut down

Until the instance is shut down
Until the statement completes
Until the session completes

I Agee your answer but in my question we have multiple answers.your answer is not match my multiple answers
Re: Regarding query [message #194167 is a reply to message #194160] Thu, 21 September 2006 01:42 Go to previous messageGo to next message
sandeepk7
Messages: 137
Registered: September 2006
Senior Member

Perhaps If defined as global variable it will remain untill the instance is not closed or variable is flushed. if defined as local variable in Declaration part of PL/SQL (procedures & Functions) will remain until PL/SQL not is finished.

Sandy
Re: Regarding query [message #194179 is a reply to message #194160] Thu, 21 September 2006 02:10 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Ahh.
Homework question is it?

Tell you what, why don't you go fire up SQL*Plus and try. You'll learn much more that way, and you'll remember it better too.

Interestingly, I just read up about the DEFINE statement here, and none of your options appear on the list of how long they stay defined for.

Quote:

Defined variables retain their values until one of the following events occurs:

you enter a new DEFINE command referencing the variable
you enter an UNDEFINE command referencing the variable
you enter an ACCEPT command referencing the variable
you reference the variable in the NEW_VALUE or OLD_VALUE clause of the COLUMN command and reference the column in a subsequent SQL SELECT command
you EXIT SQL*Plus



Of course, it's posible that when you say
Quote:

Once defined, how long will a variable remain so in SQL*Plus
you actually mean
Quote:

Once defined, how long will a variable remain so in Pl/Sql
but that would be a different question.
Previous Topic: How can I do a one-to-one join without keys
Next Topic: Union and then OrderBy
Goto Forum:
  


Current Time: Thu Dec 08 18:25:28 CST 2016

Total time taken to generate the page: 0.05597 seconds