09-23-2008
VAR=`sqlplus -S <user_id>/<password>@<instance_name> @<sql_file>
your sql code here
`
VAR will have the output.
or
you can use the Spool option in sqlplus, which will store the output into a flat file.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am new to UNIX.
I got the file from Oracle, with
two columns (Table Name and Column Name). I need to create the shell script where the result suppose to include
plain text, <table_name>, <Column_name> from the file.
Plain text will be the statements to create index in Oracle.
something like... (1 Reply)
Discussion started by: newuser100
1 Replies
2. UNIX for Advanced & Expert Users
Can I do something like this from a shellscript ?:
ftp 12.34.56.78 <<!
username
password
put a.c
bye
!
It does not go through as the login fails.
Is there any alternative to do the above requirement?
Thanks in advance.
Gowrish (3 Replies)
Discussion started by: ggowrish
3 Replies
3. Shell Programming and Scripting
Hello. I am a novince at writing shell scripts but here is the question. I have to write a shell script that does the following:
Once executed via crontab, the script should do the following:
a. get date/time stamp in for format 10-MAR-05 and
b. execute shell script my_script.sh (which... (2 Replies)
Discussion started by: jigarlakhani
2 Replies
4. Shell Programming and Scripting
Hello everyone,
I have a RHEL 5 system and have been trying to get a batch of 3-4 scripts each in a separate variables and they are not working as expected.
I tried using following syntax which I saw a lot of people on this site use and should really work, though for some reason it doesn't... (3 Replies)
Discussion started by: rockf1bull
3 Replies
5. Shell Programming and Scripting
hi all,
i need the shell script for he below requirement
i had the input file as
a_20121217_035120( frmat is a_date_hhmmss)
a_20121217_035128
a_20121217_035456
a_20121217_035767
a_20121217_035178
a_20121217_035189
a_20121217_035220
my output should be
a_20121217_035456... (0 Replies)
Discussion started by: hemanthsaikumar
0 Replies
6. Shell Programming and Scripting
I am new in shell script i want to convert .txt file
in the format axsjdijdjjdk to
a
x
s
j
d
i
j
d
j
j
d
k (5 Replies)
Discussion started by: sreejithalokkan
5 Replies
7. Shell Programming and Scripting
i am using bash shell
Whenever i declare an array, and then using sqlplus, i am getting sqlplus error and return code 127.
IFS=","
declare -a Arr=($Variable1);
SQLPLUS=sqlplus -s "${DBUSER}"/"${DBPASS}"@"${DBASE}
echo "set head off ; " > ${SQLCMD}
echo "set PAGESIZE 0 ;" >> ${SQLCMD}... (6 Replies)
Discussion started by: arghadeep adity
6 Replies
8. Shell Programming and Scripting
cat << EOF | telnet alt1.aspmx.l.google.com 25
HELO verify-email.org
MAIL FROM: <check@verify-email.org>
RCPT TO: <test@gmail.com>
quit
EOF
Hello, I'm trying to get the result of that execution, and can not see the result or bring it to a txt ... the direct command in ssh running the result... (5 Replies)
Discussion started by: c0i0t3
5 Replies
9. Shell Programming and Scripting
Hi All,
we have requirement, i am created a shell script , inside i am connecting sqlplus and execute the query. below my code for your reference.
get_sqlid ()
{
sqlid=$(
sqlplus -s $PBDW_USERID/$PBDW_PW@$PBDW_SID <<EOF
DEFINE TBLNAME=$1
set feedback off
set serverout on size... (4 Replies)
Discussion started by: KK230689
4 Replies
LEARN ABOUT REDHAT
select_into
SELECT
INTO(7) SQL Commands SELECT INTO(7)
NAME
SELECT INTO - create a new table from the results of a query
SYNOPSIS
SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
* | expression [ AS output_name ] [, ...]
INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table
[ FROM from_item [, ...] ]
[ WHERE condition ]
[ GROUP BY expression [, ...] ]
[ HAVING condition [, ...] ]
[ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]
[ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
[ LIMIT { count | ALL } ]
[ OFFSET start ]
[ FOR UPDATE [ OF tablename [, ...] ] ]
INPUTS
TEMPORARY
TEMP If specified, the table is created as a temporary table. Refer to CREATE TABLE [create_table(7)] for details.
new_table
The name (optionally schema-qualified) of the table to be created.
All other inputs are described in detail for SELECT [select(7)].
OUTPUTS
Refer to CREATE TABLE [create_table(7)] and SELECT [select(7)] for a summary of possible output messages.
DESCRIPTION
SELECT INTO creates a new table and fills it with data computed by a query. The data is not returned to the client, as it is with a normal
SELECT. The new table's columns have the names and data types associated with the output columns of the SELECT.
Note: CREATE TABLE AS [create_table_as(7)] is functionally equivalent to SELECT INTO. CREATE TABLE AS is the recommended syntax,
since SELECT INTO is not standard. In fact, this form of SELECT INTO is not available in PL/pgSQL or ecpg(1), because they interpret
the INTO clause differently.
COMPATIBILITY
SQL92 uses SELECT ... INTO to represent selecting values into scalar variables of a host program, rather than creating a new table. This
indeed is the usage found in PL/pgSQL and ecpg(1). The PostgreSQL usage of SELECT INTO to represent table creation is historical. It's
best to use CREATE TABLE AS for this purpose in new code. (CREATE TABLE AS isn't standard either, but it's less likely to cause confu-
sion.)
SQL - Language Statements 2002-11-22 SELECT INTO(7)