Advertisement

02.22.2008 at 07:27AM PST, ID: 23184703 | Points: 250
[x]
Attachment Details

Oracle JDeveloper Calling a PL/SQL Ref Cursor with dynamic number of columns

Asked by martinley in JDeveloper, Java Programming Language, New to Java Programming

Tags: Oracle, JDeveloper, 10.1.3.3.0, PL/SQL Java, Internet Explorer

Hi,

I am very new to JDeveloper and trying top develop an avalibility calendar, I have the attached (code snippet) PL/SQL Procedure that takes a date and returns the calendar for that month:

To call this procedure in TOAD I run the below script:

VARIABLE x REFCURSOR
SET AUTOPRINT ON

BEGIN
xxml_calendar_pkg.get_calendar(sysdate,:x);
END;

Depending on the date entered, the results tables has either 28, 29, 30 or 31 day columns plus the 3 standard columns. Is it possible to generate this output table in JDeveloper so that the number of columns is determined at runtime?

Does any one have any documentation on how to do this or if it is not possible any suggestions on the best way to output this in JDeveloper.

Many Thanks

Martin

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
CREATE OR REPLACE PACKAGE BODY xxmlRefCursor IS
PROCEDURE get_calendar(p_date DATE, the_cursor IN OUT ref_cursor) IS
l_query long := 'select name, manager, department ';
p_start date;
p_end date;
 
BEGIN
select last_day(p_date)
into p_end
from dual;
 
select to_date(substr(p_date,4,3),'MON')
into p_start
from dual;
 
for i in 1 .. trunc(p_end)-trunc(p_start)+1
LOOP
l_query := l_query || ', max( decode( trunc(date_start), ' ||
'to_date( ''' || to_char(p_start+i-1,'yyyymmdd') || ''', ''yyyymmdd'' ), absence_category, 0 )) "' ||
to_char(p_start+i-1) || '"';
END LOOP;
l_query := l_query || ' from xxml_absence_person group by name, manager, department';
 
OPEN the_cursor FOR l_query;
 
END get_calendar;
END xxmlRefCursor;
 
 
Loading Advertisement...
 
[+][-]02.22.2008 at 08:33AM PST, ID: 20958963

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.22.2008 at 08:59AM PST, ID: 20959234

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.22.2008 at 10:02AM PST, ID: 20959755

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628