Hi,
I am trying to insert a record into a table (say dips_tbl) which resides in Oracle DB through a ksh script. I want to insert records into few of the table columns-not all. I'll give an e.g. for the date column "CREATE_DATE".
For that I first execute
SQL1="SELECT SYSDATE FROM DUAL"
sqlplus -s << EOF > ${RESULT_1}
${CONNECT}
set verify off
set feedback off
set echo off
set pagesize 0
set linesize 250
${SQL1};
${SQL2};
exit;
EOF
Then I retrieve the value and store it in a variable:
TODAY_DATE=`cat RESULT_1 | head -1` (RESULT_1 has other sql command's executed results too)
Construction of the SQL statement for an "insert":
SQL3="INSERT INTO dips_tbl(COL1,COL2,COL3,CREATE_DATE,COL4,COL5) VALUES(${COL1},${COL2},${COL3},${TODAY_DATE},${COL4},${COL5})"
When I execute SQL3 statement; I get an error in the RESULT_2 as:
INSERT INTO dips_tbl(COL1,COL2,COL3,CREATE_DATE,COL4,COL5) VALUES(<"some value1">,<some value2>, <some value3>,"15-MAR-10",<some value4>,<some value5>)
*
ERROR at line 1:
ORA-00984: column not allowed here
I have quoted (" ") all the varchar values. But still it throws the same error. How to resolve the above error? Please help.
-dips