Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How is use sselect statement o/p in insert statement.

Tags
insert, shell scripts, statement

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 08-06-2008
How is use sselect statement o/p in insert statement.

Hi All,

I am using Unix ksh script.

I need to insert values to a table using the o/p from a slelect statement.

Can anybody Help!

My script looks like tihs.

---`sqlplus -s username/password@SID << EOF
set heading off
set feedback off
set pages 0
insert into ${TB_NAME}_D
(select
A.${PRI_KEY1},
A.${PRI_KEY2,
A.${PRI_KEY3},
${col_name}, - this is variable from script
A.${col_name},
B.${col_name}
from
${TB_NAME} A,
${DEV_DB}.${TB_NAME} B
where
A.${PRI_KEY1}=B.${PRI_KEY1} and
A.${PRI_KEY2}=B.${PRI_KEY2} and
A.${PRI_KEY3}=B.${PRI_KEY3} and
A.${col_name}!=B.${col_name} and
ROWNUM <= ${THRESHOLD})
;
commit;
exit;
EOF`


Thanks in advance
# 2  
Old 08-06-2008
Your script looks fine, as long as you have defined all of the variables (PRI_KEY*, col_name, etc.). Is it not working?
# 3  
Old 08-06-2008
I got the script to run

I forgot to close the brace after Primary_key2 and quotes for the shell variable.

Thanks for your reply.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Single quotes insert statement using awk Mathew_paul Shell Programming and Scripting 1 09-27-2017 11:27 AM
Convert Update statement into Insert statement in UNIX using awk, sed.... dev123 Shell Programming and Scripting 0 03-22-2016 03:37 AM
How to insert date in a statement? pinpe Shell Programming and Scripting 8 07-09-2011 12:49 PM
How to insert numbers to a in between statement pinpe Shell Programming and Scripting 14 06-19-2011 04:33 PM
Assign variable for INSERT INTO statement Poonamol Programming 16 10-25-2010 03:51 PM
Dynamic Insert statement pritish.sas Programming 1 07-30-2009 03:37 PM
error in insert statement ragavhere Shell Programming and Scripting 2 12-08-2008 02:44 AM
Script does not execute Insert Statement Amruta Pitkar Shell Programming and Scripting 4 08-24-2006 11:14 PM
Insert TAB in echo statement sunils27 Shell Programming and Scripting 5 08-26-2005 03:36 AM
awk command for INSERT statement nattynatty Shell Programming and Scripting 4 05-10-2002 02:11 PM


All times are GMT -4. The time now is 05:20 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password