Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
I had written a oracle procedure in shell script.
In shell script I am reading each line of file and checking 7th field of line if it is "1" then copying EMPNAME,EMPID and EMPBDATE from input file to insert into database table.
Here is procedure,
INS_REC=$(sqlplus scott/tiger@EMPLOYEE<< EOF
set head off
set feed off
set serveroutput on
INSERT INTO TBL1 ( EMPNAME,EMPID,EMPBDATE)
VALUES($EMPNAME,$EMPID,TO_DATE($EMPBDATE,'YYYY-MM-DD'));
end;
/
EOF)
TBL_ERR=$(echo "$INS_REC" | grep -e "SP2-" -e "ORA-")
echo $TBL_ERR >> $LOGFILE
I had written a oracle procedure in shell script.
In shell script I am reading each line of file and checking 7th field of line if it is "1" then copying EMPNAME,EMPID and EMPBDATE from input file to insert into database table.
Here is procedure,
Thanks in advance.
Try this (notice the quotes):
Code:
INS_REC=$(sqlplus scott/tiger@EMPLOYEE<< EOF
set head off feed off
set serveroutput on
INSERT INTO TBL1 ( EMPNAME,EMPID,EMPBDATE)
VALUES ('$EMPNAME','$EMPID',TO_DATE('$EMPBDATE','YYYY-MM-DD'));
/
EOF)
TBL_ERR=$(echo "$INS_REC" | grep -e "SP2-" -e "ORA-")
echo $TBL_ERR >> $LOGFILE
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
Bookmarks