If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Want date entered automatically(newbie)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-01-03, 15:03
donnie_darko donnie_darko is offline
Registered User
 
Join Date: Oct 2003
Location: England
Posts: 15
Want date entered automatically(newbie)

Hi,
I'm using Oracle 9i. I am trying to create a procedure that automatically enters today's date into the attendance table when the student's name is passed to the procedure. Here are the 2 tables I am using:
Student table:
Student_id First_name Last_name Sex Title

Attendance Table:
Student_id Att_date

I have the following procedure which I have created that requires the attendance date to be passed as a parameter:

CREATE OR REPLACE PROCEDURE ATTEND(FNAME VARCHAR2, LNAME VARCHAR2, DATEATTEND DATE) AS
BEGIN

UPDATE ATTENDANCE
SET ATT_DATE = DATEATTEND
WHERE STUDENT_ID =
(SELECT A.STUDENT_ID
FROM STUDENT S, ATTENDANCE A
WHERE S.STUDENT_ID = A.STUDENT_ID AND S.FIRST_NAME = FNAME AND S.LAST_NAME = LNAME);

END;

I have looked at SQL functions such as SYSDATE but do not really understand how to use them and have performed a search on this forum but again didn't find anything to use.

I was thinking that maybe SET ATT_DATE = DATEATTEND might be changed so that DATEATTEND is replaced with a built-in function.

If anybody has a solution to my problem please post. Thanks.
Reply With Quote
  #2 (permalink)  
Old 11-02-03, 19:59
ksteiger ksteiger is offline
Registered User
 
Join Date: Sep 2003
Posts: 1
getDate function

try inserting the getDate function or whatever oracle uses as its date function into your stored procedure. Rather than pass the value from a server side page, you should be able to simply insert the current date (using the date function) for that value...
Reply With Quote
  #3 (permalink)  
Old 11-03-03, 08:42
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Want date entered automatically(newbie)

UPDATE ATTENDANCE
SET ATT_DATE = SYSDATE
WHERE ...;
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On