0

I've got this timestamp field:

    if [ "${arr[1]}" != "NUMBER" ];
    then
        fieldtmst=`echo $var | 
            awk 'BEGIN { f="'"'"'" }
            {
               split($0,x,/@#/);
               printf    "%s\n", f x[1] f
            }'`
    else
        fieldtmst=`echo $var |
            awk '{ split($0,x,"@#"); print x[1]}'`   
    fi  

Well this code needs me to make an insert; when i write the insert this part of code recognize if the field i'm going to insert is a NUMBER or not and if is not NUMBER this field will be insert with quotes (something like: 'fieldtmst') and if is NUMBER (fieldtmst) without quotes..Ok, now i have a problem. I have to implement in this code that if is timestamp will be write with quotes of course, and with to_timestamp and the NLS_DATE_LANGUAGE = American. So the output of that field will be something like:

to_timestamp('02-JAN-13 01.06.00.000000 PM','DD-MON-YY HH.MI.SS.FF6 AM','NLS_DATE_LANGUAGE = American'),

Understand? Thanks

Henk Langeveld
  • 8,088
  • 1
  • 43
  • 57
Atlas91
  • 5,754
  • 17
  • 69
  • 141
  • Yeah would be very simple in that way :) but is an dynamic insert.. It's all automated so i have to make the check for every field to know what kind of data_type it is. But if it's a `date` or `timestamp` i must insert in some way the `to_date` or `to_timestamp` in that field and the `NLS_DATE_LANGUAGE = American` because without them i get errors. – Atlas91 Jun 12 '13 at 09:03
  • That still doesn't explain what the problem is, unless I'm missing something. You've said what you want to do, not why you can't do it. What have you tried, and what doesn't work? – Alex Poole Jun 12 '13 at 09:09
  • in the if condition i posted i want implement that if that field is data or timestamp write it `fieldtmst=`echo $var | awk 'BEGIN {` `f="'"'"'" } {split($0,x,/@#/); printf "%s\n", f xTO_DATE(here before` `the result of field for example)[1] f}'` ` hope you understand now. – Atlas91 Jun 12 '13 at 09:13

0 Answers0