Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Insert sysdate - Need assistance

Re: Insert sysdate - Need assistance

From: Ian Ledzion <ian.ledzion_at_lgxbow.com>
Date: Wed, 2 May 2001 08:45:54 +0200
Message-ID: <9coag0$lq7$1@rex.ip-plus.net>

As Sybrand said, by defining your column with DEFAULT SYSDATE, and leaving it out of the INSERT statement, Oracle will automatically put the date into the column.

Your statement would look like this:

strInsert = "INSERT INTO FIX ( RID, NAME, DEPARTMENT, STANDARD, FIXIT, RNAME, PROBLEM, CURRENTSTATUS) VALUES (" & intTempKey & ",

'"&UCASE(name)&"', '"&UCASE(department)&"', '"&UCASE(standard)&"',
'"&UCASE(fixit)&"', '"&UCASE(rname)&"', '"&UCASE(problem)&"',
'"&UCASE(currentstatus)&"')"

"Jimi" <Jimi_at_NOSPAM.com> wrote in message news:HFMH6.3952$VM5.127870_at_ozemail.com.au...
> Sybrand,
>
> I am using Oracle 8i on Windows NT ( Which i have no choice ) and all i
 want
> to do is insert the current date into that field, i am still only a
 beginner
> any help with this would be appreciated! The site i am working on uses asp
> pages to interface with the database.
>
> Sean
>
>
>
>
> Sybrand Bakker wrote in message ...
> >
> >"Jimi" <Jimi_at_NOSPAM.com> wrote in message
> >news:UbMH6.3935$VM5.127397_at_ozemail.com.au...
> >> Emil,
> >>
> >> I can't get the syntax correct this is my statement
> >>
> >> strInsert = "INSERT INTO FIX ( RID, DATEREC, NAME, DEPARTMENT,
 STANDARD,
> >> FIXIT, RNAME, PROBLEM, CURRENTSTATUS) VALUES (" & intTempKey & ",
> >> '"&(SYSDATE)&"', '"&UCASE(name)&"', '"&UCASE(department)&"',
> >> '"&UCASE(standard)&"', '"&UCASE(fixit)&"', '"&UCASE(rname)&"',
> >> '"&UCASE(problem)&"', '"&UCASE(currentstatus)&"')"
> >>
> >> And this is the output, i have tried many ways of using sysdate in my
 insert
> >> querys but i either get an error or i get no value returned.
> >>
> >> INSERT INTO FIX ( RID, DATEREC, NAME, DEPARTMENT, STANDARD, FIXIT,
 RNAME,
> >> PROBLEM, CURRENTSTATUS) VALUES (285, '', 'NATHAN WARD', 'ENGINEERING',
> >> 'AS/NZS ISO 9001', 'CORRECTIVE ACTION', 'ENG - ACTIVATION AND TESTING',
> >> 'TEST ', 'OPEN')
> >>
> >> Any ideas about syntax?
> >>
> >> Thanks in advance
> >>
> >>
> >>
> >>
> >> Emil Andrici wrote in message <3aeea951$1_3_at_news01.one.net.au>...
> >> >What's the point of converting a date (SYSDATE) to date again?
> >> >Replace DATEREC=TO_DATE('SYSDATE', 'DD-MON-YYYY')
> >> >with SYSDATE or TRUNC(SYSDATE) if you want to ignore the time.
> >> >
> >> >Emil
> >> >
> >> >
> >> >Jimi wrote in message ...
> >> >>Hi,
> >> >>
> >> >>I am having trouble inserting the system date into Oracle 8i, can
 anyone
> >> >>help me with the syntax?
> >> >>
> >> >>Sean
> >> >>
> >> >>strInsert = "INSERT INTO FIX ( RID, DATEREC, NAME, DEPARTMENT,
 STANDARD,
> >> >>FIXIT, RNAME, PROBLEM, CURRENTSTATUS) VALUES (" & intTempKey & ",
> >> >>DATEREC=TO_DATE('SYSDATE', 'DD-MON-YYYY'), '"&UCASE(name)&"',
> >> >>'"&UCASE(department)&"', '"&UCASE(standard)&"', '"&UCASE(fixit)&"',
> >> >>'"&UCASE(rname)&"', '"&UCASE(problem)&"',
 '"&UCASE(currentstatus)&"')"
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >Why don't you just
> >alter table fix modify (daterec default sysdate)
> >
> >in your last statement, the empty string in true Oracle syntax should be
> >NULL. You are still mixing Oracle syntax and VB syntax. Why?
> >
> >Regards,
> >
> >Sybrand Bakker, Oracle DBA
> >
> >
> >
>
>
Received on Wed May 02 2001 - 01:45:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US