Hi,
I see 2 problems with your query:
1) When you define an alias for a column either use double quotes to make it case sensitive or do not use quotes at all.
2) You try to concatenate 2 columns and somehow throw the alias definition into the middle of that concatenation. The result of the query without the alias definition is a single column, which can be aliased, but you cannot alias just a part of it.
I'll dare a wild guess about your final goal: you try to create a report with comma separated columns with headings. For this you either have to create the headings yourself or drop the concatenation.
Creating the headings is quite simple and usually preferred over the other method if columns do not have to have a fixed width:
The other way is to tell sqlplus how to format your report:
Try both methods and use what fits your needs best.
Hi people, i need youre help on this.
I need to create an Shell SCript to list in a directory some sql files and then execute them one by one .
Also i need to have Logs from the executed Sql's to send to our costummers.
Can anyone help me on this
Regards,
osramos (2 Replies)
Hi,
I know in oracle a .sql file is called by @ <path> /<filename>.
But how to call in sql 2005, I am opening the sql sessionwith sqsh, is there any command to execute there a .sql file (query in sql 2005) in K shell script. (0 Replies)
query sql using shell script, is it possible?
my friend told me to do a file.sql and link to my shell script, but can i query sql using shell script?
thanks in advance! (2 Replies)
hi all,
how to execute shell script in another server that contain sql script. i tried using "ssh -l" option.. but i am unable to load the environment variable of the remote host.
please suggest how execute the shell script contain sql part inside it. (2 Replies)
hi all,
I'm new to shell scripting, i want to know how to use the sql statements from the shell script? is there any documents or pdf to learn from the begining? plese provide me some useful links on the same.
Thanks all in advance..,:b: (3 Replies)
Hi
I am new in unix. oracle and unix are installed in my sytem.i need the script
which could connect to the oracle using username ,password and schema and can run the select * from tab query.
Thanks
vijay (8 Replies)
Hi,
I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database.
For instance:
USER CITY
--------- ----------
A CITY_A
B CITY_B
C ... (2 Replies)
hey , i am using this code to store value of a sql query and and then use
it in other query but after some time , but it is not working. please help
#!/bin/bash
val_1=$( sqlplus -s rte/rted2@rel76d2 << EOF
setting heading off
select max(stat_id) from cvt_stats;
exit
EOF
)
nohup... (5 Replies)
hello forum ,
I am new to shell scripting. as part of my assignment i have to execute a sql querry from the shell script. please help me.
example.
sql queerry:db2 "select emp_id from tsble emp".
i have to execute the above querry from the script.
advance thanks to forum
Siva ranganath (1 Reply)
Hi All,
I want some help in writing a shell script which will be in the below form:
A logical representation of shell scripts:
->Shell scripts start
->Connect to database
->Execute a sql and store the output in a cursor(need to know is there any concept of cursor in unix)
->Using a loop... (2 Replies)
Discussion started by: Chitragupta
2 Replies
LEARN ABOUT OPENSOLARIS
subst
subst(1T) Tcl Built-In Commands subst(1T)__________________________________________________________________________________________________________________________________________________NAME
subst - Perform backslash, command, and variable substitutions
SYNOPSIS
subst ?-nobackslashes? ?-nocommands? ?-novariables? string
_________________________________________________________________DESCRIPTION
This command performs variable substitutions, command substitutions, and backslash substitutions on its string argument and returns the
fully-substituted result. The substitutions are performed in exactly the same way as for Tcl commands. As a result, the string argument
is actually substituted twice, once by the Tcl parser in the usual fashion for Tcl commands, and again by the subst command.
If any of the -nobackslashes, -nocommands, or -novariables are specified, then the corresponding substitutions are not performed. For
example, if -nocommands is specified, command substitution is not performed: open and close brackets are treated as ordinary characters
with no special interpretation.
Note that the substitution of one kind can include substitution of other kinds. For example, even when the -novariables option is speci- |
fied, command substitution is performed without restriction. This means that any variable substitution necessary to complete the command |
substitution will still take place. Likewise, any command substitution necessary to complete a variable substitution will take place, even |
when -nocommands is specified. See the EXAMPLES below. |
If an error occurs during substitution, then subst will return that error. If a break exception occurs during command or variable substi- |
tution, the result of the whole substitution will be the string (as substituted) up to the start of the substitution that raised the excep- |
tion. If a continue exception occurs during the evaluation of a command or variable substitution, an empty string will be substituted for |
that entire command or variable substitution (as long as it is well-formed Tcl.) If a return exception occurs, or any other return code is |
returned during command or variable substitution, then the returned value is substituted for that substitution. See the EXAMPLES below. |
In this way, all exceptional return codes are ``caught'' by subst. The subst command itself will either return an error, or will complete |
successfully.
EXAMPLES
When it performs its substitutions, subst does not give any special treatment to double quotes or curly braces (except within command sub-
stitutions) so the script
set a 44
subst {xyz {$a}}
returns ``xyz {44}'', not ``xyz {$a}'' and the script |
set a "p} q {r" |
subst {xyz {$a}} |
return ``xyz {p} q {r}'', not ``xyz {p} q {r}''. |
When command substitution is performed, it includes any variable substitution necessary to evaluate the script. |
set a 44 |
subst -novariables {$a [format $a]} |
returns ``$a 44'', not ``$a $a''. Similarly, when variable substitution is performed, it includes any command substitution necessary to |
retrieve the value of the variable. |
proc b {} {return c} |
array set a {c c [b] tricky} |
subst -nocommands {[b] $a([b])} |
returns ``[b] c'', not ``[b] tricky''. |
The continue and break exceptions allow command substitutions to prevent substitution of the rest of the command substitution and the rest |
of string respectively, giving script authors more options when processing text using subst. For example, the script |
subst {abc,[break],def} |
returns ``abc,'', not ``abc,,def'' and the script |
subst {abc,[continue;expr 1+2],def} |
returns ``abc,,def'', not ``abc,3,def''. |
Other exceptional return codes substitute the returned value |
subst {abc,[return foo;expr 1+2],def} |
returns ``abc,foo,def'', not ``abc,3,def'' and |
subst {abc,[return -code 10 foo;expr 1+2],def} |
also returns ``abc,foo,def'', not ``abc,3,def''.
SEE ALSO Tcl(1T), eval(1T), break(1T), continue(1T)KEYWORDS
backslash substitution, command substitution, variable substitution
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tcl 7.4 subst(1T)