Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3439720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:20:40+00:00 2026-05-18T08:20:40+00:00

To whom it may respond to , I am trying to return list of

  • 0

To whom it may respond to ,

I am trying to return list of dates and weekdays to be used in other functions. Code below is compiled without error. But it should give output of 15 days (via V_MAX_DAYS variable) and number of the day in that week.

I have tried to implement like this, but cannot get output using DBMS_OUTPUT. I want to test it but got ORA-06532 error at when running .
My aim is to return values to asp.net application as we have done using SYS_REFCURSOR.
How can I achieve that?
Thank you for your concern,

The script is as below :

CREATE OR REPLACE TYPE DATE_ROW AS OBJECT
(
  WEEKDAY_VALUE DATE,
  DATE_IN_LIST VARCHAR2(5)
)
/

CREATE OR REPLACE TYPE DATE_TABLE as table of DATE_ROW
/



CREATE OR REPLACE FUNCTION FN_LISTDATES
   RETURN DATE_TABLE
IS
   V_DATE_TABLE        DATE_TABLE    := DATE_TABLE ();
   V_MAX_DAYS          NUMBER        := 15;
   V_CALCULATED_DATE   DATE;
   V_WEEKDAY           VARCHAR2 (5);
BEGIN
   FOR X IN -2 .. V_MAX_DAYS
   LOOP
      SELECT TO_DATE (TO_CHAR (SYSDATE + X, 'DD.MM.YYYY'))
        INTO V_CALCULATED_DATE
        FROM DUAL;
      V_DATE_TABLE.EXTEND;
      V_DATE_TABLE(X) := DATE_ROW(V_CALCULATED_DATE, 'Test');
   END LOOP;
   RETURN V_DATE_TABLE;
END;
/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:20:41+00:00Added an answer on May 18, 2026 at 8:20 am

    A few points.

    1. If you want a DATE (V_CALCULATED_DATE) that is X days from SYSDATE with the time component set to midnight, which appears to be your intent here, you would want something like v_calculated_date := TRUNC(sysdate) + x;. A TO_DATE without an explicit format mask is going to create issues if a future session’s NLS_DATE_FORMAT happens not to be DD.MM.YYYY
    2. If you really want to return a collection like this, your collection indexes would need to start with 1, not -2. You could accomplish that by doing v_date_table(x+3) := DATE_ROW(v_calculated_date, 'Test');.
    3. However, I would tend to suspect that you would be better served here with a pipelined table function.

    The pipelined table function would look something like

    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE OR REPLACE FUNCTION FN_LISTDATES
      2     RETURN DATE_TABLE
      3     PIPELINED
      4  IS
      5     V_MAX_DAYS          NUMBER        := 15;
      6     V_CALCULATED_DATE   DATE;
      7     V_WEEKDAY           VARCHAR2 (5);
      8  BEGIN
      9     FOR X IN -2 .. V_MAX_DAYS
     10     LOOP
     11        v_calculated_date := trunc(sysdate) + x;
     12        PIPE ROW( DATE_ROW(v_calculated_date,'Test') );
     13     END LOOP;
     14     RETURN;
     15* END;
    SQL> /
    
    Function created.
    
    SQL> select * from table( fn_listDates );
    
    WEEKDAY_V DATE_
    --------- -----
    30-NOV-10 Test
    01-DEC-10 Test
    02-DEC-10 Test
    03-DEC-10 Test
    04-DEC-10 Test
    05-DEC-10 Test
    06-DEC-10 Test
    07-DEC-10 Test
    08-DEC-10 Test
    09-DEC-10 Test
    10-DEC-10 Test
    
    WEEKDAY_V DATE_
    --------- -----
    11-DEC-10 Test
    12-DEC-10 Test
    13-DEC-10 Test
    14-DEC-10 Test
    15-DEC-10 Test
    16-DEC-10 Test
    17-DEC-10 Test
    
    18 rows selected.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To whom it may concern, I am trying to make a list navigation menu
To whom it may respond to , I have installed/re-installed odac client 11.2.0.1.2 but
To whom it may respond to, We would like to use SELECT function with
To whom this may concern, This is some code to a card game simulation.
To whom it may respond to, We have installed Oracle 11g r2 on a
i want to display a list of emails to whom i send an email
One of clients to whom we provided with source code said that by changing
how to list all of the users whom has at least one running process.
I'm trying to save the positions of several images whom are inside my view.
I have a page showing a list of persons with whom you have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.