DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Calender in SQL*PLUS

  1. #1
    Join Date
    Aug 2001
    Location
    cuddapah
    Posts
    145

    Question

    !I Come to here that we can display CALENDER for the given months it is posiable.

    Is there any command like that to display calender in sql*plus ?

  2. #2
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    Just try this

    Flicked from jmodic's prev. post

    SELECT
    TRUNC(sysdate,'YYYY')+ROWNUM -1,
    TO_CHAR(TRUNC(sysdate,'YYYY')+ROWNUM -1,'MONTH'),
    TO_CHAR(TRUNC(sysdate,'YYYY')+ROWNUM -1,'DD'),
    ROWNUM
    FROM all_objects
    WHERE TRUNC(sysdate,'YYYY')+ROWNUM -1 < ADD_MONTHS(TRUNC(sysdate,'YYYY'),12);

    Cheers!
    Cheers!
    OraKid.

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    declare
    in_put_mon varchar2(100) := '01-FEB-2000';
    in_put_row number := 32;
    lv_last_date varchar2(10);
    lv_get_day varchar2(10);
    lv_get_date date;
    type ref_c1 is ref cursor;
    c1 ref_c1;
    type obj_val_output is table of varchar2(10) index by binary_integer;
    lv_val_output obj_val_output;
    begin
    select last_day(in_put_mon) into lv_last_date from dual;
    dbms_output.put_line('lv_last_date' || lv_last_date);
    open c1 for 'SELECT trunc(to_date(' || chr(39) || in_put_mon || chr(39) || ',''dd-mon-yyyy''),''mon'') + ROWNUM - 1 val FROM all_objects WHERE rownum < ' || in_put_row;
    fetch c1 bulk collect into lv_val_output;
    for i in 1..lv_val_output.count loop
    dbms_output.put_line('Date: >>> ' || lv_val_output(i));
    lv_get_date := lv_val_output(i);
    lv_get_day := to_char(lv_get_date,'Day');
    dbms_output.put_line('Day : >>> ' || lv_get_day );
    if lv_last_date = lv_val_output(i) then
    return;
    end if;
    end loop;
    end;

    This might help u if u wanna hv a procedure

    Cheers!
    Cheers!
    OraKid.

Posting Permissions

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


Click Here to Expand Forum to Full Width