Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Oracle using SYSDATE

Status
Not open for further replies.

TStriker

Programmer
Nov 12, 2003
277
US
Hi All,

I have a rookie question that involves an ASP page as it interacts with Oracle. I think my problem is more on the Oracle side of things so I'll try here.

All I'm trying to do is pop the SYSDATE (date and time on the Db server) into a date field. Here's the command:

objRs.Fields("apprvl_dt").Value = "28-AUG-06"

As stated, I want to use SYSDATE rather than explicitly entering a date and time.

Any ideas?

-Striker
 
Striker,

I apologise for not being familiar with ASP, but in Oracle, we use the zero-argument function, SYSDATE, to provide Date and Time. In a Select statement, if we wanted to see tomorrow's date and time (24 hours from now), we could say:
Code:
select to_char(sysdate+1,'yyyy-mm-dd hh24:mi:ss') tomorrow from dual;

TOMORROW
-------------------
2006-08-29 15:47:10

1 row selected.
In PL/SQL, you could assign that same value as follows:
Code:
set serveroutput on
declare
    tomorrow date;
begin
    tomorrow := sysdate+1;
    dbms_output.put_line('Tomorrow will be '||to_char(tomorrow,'yyyy-mm-dd hh24:mi:ss')||'.');
end;
/
Tomorrow will be 2006-08-29 15:47:15.

PL/SQL procedure successfully completed.
Let us know if this gives you the insight you need to resolve your issue.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Hi,
Also, you could set the DEFAULT value of that field to SYSDATE so that when you add a record, if that field is not specifically set by your insert code, SYSDATE would be used..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top