Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    England
    Posts
    15

    Unanswered: 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.

  2. #2
    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...

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Want date entered automatically(newbie)

    UPDATE ATTENDANCE
    SET ATT_DATE = SYSDATE
    WHERE ...;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •