LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Regarding date Format (http://www.linuxquestions.org/questions/programming-9/regarding-date-format-471943/)

ancys 08-08-2006 08:23 AM

Regarding date Format
 
hi all
In table sample column process_date datatype is Date

in unix script i m getting the current date and that value should be updated in process_date
#!bin/sh
start_date=`date '+%d%m%y'`

/oraclepath uname/pwd@dbname<<EOF
update samp
set process_date='$start_date'
EOF

But values is not updated how to update the value in this column
help please!!!

homey 08-08-2006 08:45 AM

You have a typo in the shebang, should be #!/bin/sh
Maybe this example will help.
Code:

#!/bin/sh

start_date=$(date '+%d%m%y')

FILE=file.txt
(
cat << EOF
update samp
set process_date='$start_date'
EOF
) > $FILE


ancys 08-08-2006 08:53 AM

The above mentioned code does not update the Process_date column

chrism01 08-09-2006 12:16 AM

Single quotes in bash do not allow interpolation (ie does not translate varname to varvalue). Try double quotes.

bigearsbilly 08-10-2006 05:35 AM

I assume you aren't running it on linux?
Try #!/bin/ksh(i prefer) or #!/bin/bash

linux /bin/sh is bash, not real bourne shell so will work
the unix version of /bin/sh code will not work


All times are GMT -5. The time now is 02:52 PM.