SQLPlus commands [message #336304] |
Fri, 25 July 2008 10:22 |
gkrishn
Messages: 506 Registered: December 2005 Location: Putty a dark screen
|
Senior Member |
|
|
set termout off
define new_prompt='nolog'
column value new_value new_prompt
select
username ||
': ' ||
substr(substr(global_name,1,30),1,
instr(substr(global_name,1,30),'.')-1)
value
from
user_users,
global_name;
set sqlprompt "&new_prompt> "
set termout on
i have two questions .
1)column value new_value new_prompt
what exactly this do ?
2)how &new_prompt get value of query output .
Thanks.
|
|
|
|
Re: SQLPlus commands [message #336367 is a reply to message #336304] |
Fri, 25 July 2008 23:42 |
|
Barbara Boehmer
Messages: 9101 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
The following is an excerpt from the online 11g SQL*Plus User's Guide and Reference in the section regarding the column command:
http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12013.htm#SQPUG034
"NEW_V[ALUE] variable
Specifies a variable to hold a column value. You can reference the variable in TTITLE commands. Use NEW_VALUE to display column values or the date in the top title. You must include the column in a BREAK command with the SKIP PAGE action. The variable name cannot contain a pound sign (#).
NEW_VALUE is useful for master/detail reports in which there is a new master record for each page. For master/detail reporting, you must also include the column in the ORDER BY clause. See the example at the end of this command description.
Variables specified with NEW_V[ALUE] are expanded before TTITLE is executed. The resulting string is stored as the TTITLE text. During subsequent execution for each page of the report, the expanded value of a variable may itself be interpreted as a variable with unexpected results.
You can avoid this double substitution in a TTITLE command by not using the & prefix for NEW_V[ALUE] variables that are to be substituted on each page of the report. If you want to use a substitution variable to insert unchanging text in a TTITLE, enclose it in quotes so that it is only substituted once.
For information on displaying a column value in the bottom title, see OLD_V[ALUE] variable below. For more information on referencing variables in titles, see the TTITLE command. For information on formatting and valid format models, see FOR[MAT] format above."
[Updated on: Fri, 25 July 2008 23:44] Report message to a moderator
|
|
|
|
|