How to declare a dynamic cursor % rowtype?
Hi guysI need to declare a variable of a dynamic cursor rowtype. Is this possible?
The porpouse this is to store this train in a pl/sql table.
Example:
DECLARE
T_CURSOR IS REF CURSOR TYPE
MY_C IS T_CURSOR;
MY_RT IS MY_C % ROWTYPE;
IS OF TYPE MY_TABLE TABLE OF INDEXES MY_RT BY BYNARI_INTEGER;
BEGIN
MY_C OPEN FOR ' SELECT * FROM MYTABLE ';
SEARCH MY_C MY_TABLE (1);
SEARCH MY_C MY_TABLE (2);
SEARCH MY_C MY_TABLE (3);
LOOK FOR MY_C IN...
END;
Obviously this Don t work, but do someone know how I can do something to get the same result?
Thank you
Alex Tutor wrote:
I need to declare a variable of a dynamic cursor rowtype. Is this possible?
Is not possible. You know upfront structure returned by ref cursor or, if you are in 11g, convert it into cursor DBMS_SQL, retrieves the structure and convert it back (or treat it in DBMS_SQL).
SY.
Tags: Database
Similar Questions
-
Dynamic cursor Type strong?
I am currently using Oracle 11.2 G and I was wondering if you can declare a dynamic cursor as a strong Ref Cursor type or it may be declared as weak type ref cursor? Now, if she can only be declared as a weak type Ref Cursor, is it possible to avoid having to explicitly declare the type names and field being returned by the cursor? Sense, is any way to avoid having to do something like that...
Instead, I was wondering if I could just set the fields and their types by defining them as a TABLE OF THE ref cursor?TYPE example_rec IS RECORD ( col1 VARCHAR2, col2 NUMBER, col3 NUMBER, etc... )
I wonder if this is possible is because I have a large number of fields returned in my cursor, and I was hoping on not having to type each person and its type. In addition, I think this would make maintenance easier.user652714 wrote:
No, not quite. I ask if I can create a strong dynamic type Ref cusors. Here is a Pseudo code:DECLARE TYPE test_rec IS TABLE OF test_cur%ROWTYPE; -- i'm wondering if i can do something like this --'The code below is what I am TRYING TO AVOID' TYPE test_cur IS REF CURSOR; TYPE test_rec IS RECORD ( col1 VARCHAR2, col2 NUMBER, col3 NUMBEr )
Is not possible.
Let's say you would set an TEST_REC as above. How would refer to the members of the structure of your code? This type could describe anything like projection of the cursor could be anything - a unique column, to a 100 columns. A combination of columns that can include data types of the LOB of tables nested SQL types defined by the user.
So, how can you refer to these columns in the structure of table TEST_REC ? Guess?
A new concept - all SQL statements are parsed, stored and executed as sliders. REF CURSOR, cursors implicit, explicit cursors and so on, are CLIENT interfaces to the created SQL cursor. Each of these interfaces to client cursor works in a specific way and provide a set of specific features.
Next concept - to extract a SQL cursor, the client code NEEDS to know the structure of the projection of this cursor SQL. The code needs to know the number and types of data in the columns returned by the cursor.
The customer may address the issue in two ways.
Statically. In other words, at the time of coding, SQL projection, returned by this SQL cursor is known. The developer can thus use some thing like + % RowType % + to indicate to the compiler that record structure to define. The compiler parses the SQL cursor in the code, describes the projection of SQL and compiles this projection of SQL as the static structure in the code.
+ % RowType + in this regard is as a #define of C macro. He tells the PL/SQL compiler to describe the cursor SQL projection, then produced a PL/SQL, based on the record structure.
Dynamically. This means at the time of coding, SQL, returned by this SQL cursor is unknown. In this case the compiler has no idea at compile time what structure will be returned by the cursor. Compiled source code may not define a static structure for this cursor SQL - the SQL cursor may return any kind of structure. The source code needs to use the same approach as what the compiler does when it comes to SQL static cursors.
The source code needs to analyze the cursor, describe the SQL cursor and then pick dynamically by the cursor. Client cursor interface that supports this approach is DBMS_SQL. No ref Cursor.
Keep in mind that these static and dynamic methods to describe how the code consumes the cursor - extraction of rows in the cursor.
A static method (where the projection of SQL is known) however apply to the TWO instructions static SQL and dynamic SQL statements. You can use dynamic SQL statements in your code, but a rule which stipulates that, regardless of the SQL code is waiting for a specific static SQL projection of this SQL cursor.
The dynamic method (where the projection of SQL is unknown) is 'real' dynamic SQL - as the projection of SQL and are all two dynamic SQL code.
Examples of Basic code:
// STATIC SQL CURSOR SQL> create or replace procedure FooProc is 2 cursor c is select object_id, object_name from user_objects; 3 type TBuffer is table of c%RowType; 4 buffer TBuffer; 5 begin 6 open c; 7 loop 8 fetch c bulk collect into buffer limit 100; 9 DBMS_OUTPUT.put_line( buffer.Count||' row(s) fetched.' ); 10 exit when c%NotFound; 11 end loop; 12 close c; 13 end; 14 / Procedure created. SQL> SQL> exec FooProc 100 row(s) fetched. 43 row(s) fetched. PL/SQL procedure successfully completed.
// STATIC SQL PROJECTION, BUT DYNAMIC SQL CURSOR SQL> create or replace procedure FooProc( c in out sys_refcursor ) is 2 E_CURSOR_ERROR exception; 3 pragma exception_init( E_CURSOR_ERROR, -00932 ); 4 type TRecord is record( 5 name varchar2(30), 6 value varchar2(100) 7 ); 8 type TBuffer is table of TRecord; 9 buffer TBuffer; 10 begin 11 loop 12 fetch c bulk collect into buffer limit 100; 13 DBMS_OUTPUT.put_line( buffer.Count||' row(s) fetched.' ); 14 exit when c%NotFound; 15 end loop; 16 close c; 17 exception when E_CURSOR_ERROR then 18 close c; 19 raise_application_error( 20 -20000, 21 'Cursor projection contains an invalid data structure.' 22 ); 23 end; 24 / Procedure created. SQL> var c refcursor SQL> exec open :c for select object_id, object_name from user_objects; PL/SQL procedure successfully completed. SQL> exec FooProc( :c ); 100 row(s) fetched. 43 row(s) fetched. PL/SQL procedure successfully completed. SQL> exec open :c for select object_id, object_name, created from user_objects; PL/SQL procedure successfully completed. SQL> exec FooProc( :c ); BEGIN FooProc( :c ); END; * ERROR at line 1: ORA-20000: Cursor projection contains an invalid data structure. ORA-06512: at "BILLY.FOOPROC", line 19 ORA-06512: at line 1
// DYNAMIC SQL AND DYNAMIC SQL PROJECTION SQL> create or replace procedure FooProc( sqlSelect varchar2 ) is 2 c integer; 3 rc integer; 4 colCnt integer; 5 fetchCnt integer; 6 projection DBMS_SQL.DESC_TAB; 7 begin 8 --// ceate and parse the cursor 9 c := DBMS_SQL.open_cursor; 10 DBMS_SQL.parse( 11 c, 12 sqlSelect, 13 DBMS_SQL.native 14 ); 15 16 rc := DBMS_SQL.execute( c ); 17 18 --// describe the sql projection 19 DBMS_SQL.describe_columns( c, colCnt, projection ); 20 21 --// the sql projection's fields/columns 22 DBMS_OUTPUT.put_line( 'SQL projection:' ); 23 for i in 1..colCnt loop 24 DBMS_OUTPUT.put_line( '- '||projection(i).col_name ); 25 end loop; 26 27 --// fetch and process 28 fetchCnt := 0; 29 loop 30 rc := DBMS_SQL.fetch_rows( c ); 31 exit when rc = 0; 32 --// use DBMS_SQL.column_value() to read fetched row's columns 33 fetchCnt := fetchCnt + 1; 34 end loop; 35 DBMS_OUTPUT.put_line( fetchCnt||' row(s) fetched.' ); 36 37 DBMS_SQL.close_cursor( c ); 38 end; 39 / Procedure created. SQL> SQL> exec FooProc( 'select object_id, object_name from user_objects' ); SQL projection: - OBJECT_ID - OBJECT_NAME 143 row(s) fetched. PL/SQL procedure successfully completed.
-
Referring to the dynamic cursor rows and columns in SQL
I have a procedure that dynamically reads a schema name and a table name in a table entry. The code must loop through all the rows and the columns in each table and the output data. I'm done with what I want to achieve 95%, but there is a little bug. The dbms_output.put(*col.column_name* ||) line '',''); ' ||
return to something like rec.col.column_name , so that it is the column of the current record. Currently, it simply displays the name of the column for each record instead of the actual value. Can someone help me to change the code to get the real value?
CREATE OR REPLACE PACKAGE BODY some_proc
-Function and procedure implementations
PROCEDURE create_files IS
CURSOR c_tbls IS
SELECT * FROM tbl_list;
l_sql VARCHAR2 (4000);
BEGIN
-To loop through all the tables
FOR tbl IN c_tbls LOOP
l_sql: = "DECLARE" | «C_tbl_recs CURSOR IS» | ' SELECT * ' |. '
'FROM ' | tbl.schema_name | '.' || tbl.table_name | '; ' ||
' t_tbl_rowtype c_tbl_recs % ROWTYPE; ' || "START" |
"FOR rec IN c_tbl_recs LOOP |
' FOR col IN (SELECT column_name ' |)
"FROM dba_tab_cols" |
"Owner WHERE ="' | " tbl.schema_name | '''' ||
' AND table_name = "' | tbl.table_name | '''' ||
ORDER BY column_id) LOOP '.
*' dbms_output.put(col.column_name ||) '',''); ' || * "END OF LOOP; dbms_output.put_line('''); END LOOP; ' ||
' END; ';
-dbms_output.put_line (l_sql);
EXECUTE IMMEDIATE l_sql;
END LOOP;
EXCEPTION
WHILE OTHERS THEN
dbms_output.put_line (SQLERRM);
END;
END;Is this what you are looking for?
(it took a few minutes)create or replace package some_proc is procedure create_files; end; / CREATE OR REPLACE PACKAGE BODY some_proc IS -- Function and procedure implementations PROCEDURE create_files IS CURSOR c_tbls IS SELECT * FROM tbl_list; CURSOR c_cols (p_table_owner VARCHAR2, p_table_name VARCHAR2) IS SELECT column_name FROM all_tab_columns WHERE owner =p_table_owner AND table_name=p_table_name ORDER BY all_tab_columns.column_id; l_sql VARCHAR2(32000); separator VARCHAR2(1):=';'; BEGIN --Loop through all tables FOR tbl IN c_tbls LOOP dbms_output.put_line('TABLE: '||tbl.schema_name||'.'||tbl.table_name); l_sql := 'DECLARE ' ; l_sql := l_sql|| ' CURSOR c_tbl_recs IS ' ; l_sql := l_sql||' SELECT * FROM ' || tbl.schema_name || '.' || tbl.table_name || '; ' ; l_sql := l_sql||' linenr number:=1; '; l_sql := l_sql||'BEGIN ' ; l_sql := l_sql|| ' FOR rec IN c_tbl_recs LOOP '; FOR c IN c_cols(tbl.schema_name,tbl.table_name) LOOP l_sql:=l_sql ||' if linenr=1 then dbms_output.put('''||c.column_name||''||separator||'''); end if; ' ; END LOOP; l_sql :=l_sql||' dbms_output.put_line(''''); linenr:=linenr+1; '; FOR c IN c_cols(tbl.schema_name,tbl.table_name) LOOP l_sql:=l_sql ||' dbms_output.put(rec.'||c.column_name||'||'''||separator||'''); ' ; END LOOP; l_sql:=l_sql||' end loop; '; l_sql:=l_sql||' dbms_output.put_line(''''); '; l_sql:=l_sql||' dbms_output.put_line(''''); '; l_sql:=l_sql||'end;'; EXECUTE IMMEDIATE l_sql; END LOOP; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(SQLERRM); END; END; /
-
How to declare a formal parameter of a record type and access function?
declare
CURSOR c_cur_minc IS SELECT FAMID, MEMBNO, AMTFED, GOVRETX, PRIVPENX, RRRDEDX, GROSPAYX, SLTAXX, SALARYX, SALARYBX OF MINC WHERE FAMID IN (SELECT FAMID FROM MEMBERS WHERE AGE > = 14 AND MINC.) FAMID = MEMBERS. FAMID AND MINC. MEMBNO = MEMBERS. MEMBNO);
number of v_limit: = 50;
TYPE minc_rec is RECORD (FAMID MINC. FAMID % TYPE,
MEMBNO MINC. MEMBNO % TYPE,
AMTFED MINC. AMTFED % TYPE,
GOVRETX MINC. GOVRETX % TYPE,
PRIVPENX MINC. PRIVPENX % TYPE,
RRRDEDX MINC. RRRDEDX % TYPE,
GROSPAYX MINC. GROSPAYX % TYPE,
SLTAXX MINC. SLTAXX % TYPE,
SALARYX MINC. SALARYX % TYPE,
SALARYBX MINC. SALARYBX % TYPE);
TYPE minc_rec_type is TABLE OF THE minc_rec;
minc_rec_type_tbl minc_rec_type;
Start
OPEN c_cur_minc.
LOOP
Get the c_cur_minc COLLECT LOOSE minc_rec_type_tbl LIMIT v_limit;
WHEN minc_rec_type_tbl EXIT. COUNT = 0;
BECAUSE me in minc_rec_type_tbl. FIRST... minc_rec_type_tbl. LAST
LOOP
IF (chk_notnull_blank (minc_rec_type_tbl (i). AMTFED)) THEN
Setting a DAY MINC SET ANFEDTX = - 2E14 WHERE FAMID = minc_rec_type_tbl (i) .famid AND MEMBNO = minc_rec_type_tbl (i) .membno;
end if;
IF (chk_notnull_blank (minc_rec_type_tbl (i). GOVRETX)) THEN
Setting a DAY MINC SET GOVRETX = - 2E14 WHERE FAMID = minc_rec_type_tbl (i) .famid AND MEMBNO = minc_rec_type_tbl (i) .membno;
end if;
END LOOP;
END LOOP;
CLOSE C_cur_minc;
END;
FUNCTION chk_notnull_blank (?) return a Boolean value is
Start
If (? is NOT NULL and? as (-8E14,-7E14,-6E14,-5E14,-4E14,-3E14,-2E14,-1E14,-1E9)) then
RETURN TRUE;
on the other
RETURN FALSE;
end if;
END chk_notnull_blank;
end;
My question is how to declare a formal FastInventory in a fuction where, in the past the current parameter is a variable of type record type number value?
Published by: kumar73 on September 21, 2010 11:22
Published by: kumar73 on September 21, 2010 11:23This is a simple function
CREATE OR REPLACE FUNCTION chk_notnull_blank(inparm IN NUMBER) RETURN NUMBER IS BEGIN if ( inparm is NOT NULL and inparm in ( -8E14, -7E14, -6E14, -5E14, -4E14, -3E14, -2E14, -1E14, -1E9 )) then RETURN TRUE ; else RETURN FALSE ; end if; END chk_notnull_blank;
Thank you
AJ -
Remove the statement that uses a subselect in the declaration of the cursor
Hi all
How to write write a delete statement that uses a subselect with the declaration of the cursor?
CURSOR excluded_dates IS SELECT TO_TIMESTAMP(report_parameter_value, in_date_format_mask) INTO my_current_date_time FROM report_parameters WHERE report_parameters.report_parameter_id = in_report_parameter_id AND report_parameters.report_parameter_group = 'DATE_TIME' AND report_parameters.report_parameter_name = 'EXCLUDED_DATE';
Thank youOPEN excluded_dates; LOOP FETCH excluded_dates INTO my_excluded_date; EXIT WHEN excluded_dates%NOTFOUND; DELETE FROM edr_rpt_tmp_inclusion_table WHERE TO_CHAR(date_time, 'mm/dd/yyyy') = TO_CHAR(my_excluded_date, 'mm/dd/yyyy'); END LOOP; CLOSE excluded_dates;
Hello
You can turn your cursor into a subquery IN
DELETE FROM edr_rpt_tmp_inclusion_table WHERE TRUNC (date_time) IN ( SELECT TRUNC (TO_TIMESTAMP(report_parameter_value, in_date_format_mask)) -- INTO my_current_date_time -- Remove this line FROM report_parameters WHERE report_parameters.report_parameter_id = in_report_parameter_id AND report_parameters.report_parameter_group = 'DATE_TIME' AND report_parameters.report_parameter_name = 'EXCLUDED_DATE' );
I used the TRUNK instead of TO_CHAR, but it works with TO_CHAR.
Published by: Frank Kulash, June 8, 2009 11:28
Remove the "my_current_date_time" line, after Sean and Sanjay (below). -
How can I change the cursor blink rate? Firefox 3.6.10 on Ubuntu.
How can I change the cursor blink rate? Firefox 3.6.10 on Ubuntu.
See this old thread forum mozillaZine on this subject:
(please don't post in these old threads)
See also:
To open the topic: config page, type Subject: config in the address bar (address) and press the 'Enter' key, as you type the url of a Web site to open a Web site.
If you see a warning then you can confirm that you want to access this page. -
How to convert a dynamic disk to a basic?
How to convert a dynamic disk to a basic? I can't really deleat the C and readers of the system, and if so, how?
Hi Brad,
Welcome to Microsoft Community and thank you for the query display.
According to the description, it seems that you want to convert a dynamic disk to Basic.
However, we need more information about the issue to help you better.
Please help me to answer these questions.
1 how many partitions are on the hard drive?
2 is installed Windows on drive C?
3. you have any operating system installed on the hard drive?
To convert the dynamic disk to basic, here are some steps that you can try.
You can try to convert the dynamic disk drive basis (except your drive C :) using the Diskpart.exe in the command line. By following these steps, you can avoid reinstalling Windows XP. But if you want all the hard disk as a single partition, then proceed as follows.
Note: Before formatting the hard drive or perform the steps, back up your data to an external storage device.
Steps to convert dynamic disk to basic
a. press Windows key + r on the keyboard and in the immediate window, type cmd.exe
b. in the command prompt and type D
iskpart
.c. at the Diskpart prompt, type
list disk
. Note the number of the disk you want to convert to dynamic.d. at the Diskpart prompt, type
select disk
. (select the dynamic disk you want to convert.)e. at the Diskpart prompt, type clean to remove all volumes on the disk.
(f) then, at the Diskpart prompt, type: convert base to begin to restore the disk to basic training.
Respond us if you have any queries with hard drive problems and we will be happy to help you.
-
How can I change the cursor in an individual account (and not the owner) a computer to my client?
Hi MichaelConner1,
You can keep the individual mouse for each user account on the computer.
Log on to each user account and then change the mouse pointer scheme using the link below and check if it helps.
http://www.Microsoft.com/enable/training/WindowsXP/pointerscheme.aspx
-
How do disable you dynamic horizontal scrolling "feature"?
How do disable you dynamic horizontal scrolling "feature"?
its totally _ me off. Im trying to use a new program of photo manipulation, but can't zoom in and because it scrolls the work area, I need trouble! Ugh! I swear to God _... it's just ridiculous!
Please someone tell me how to disable this "feature".musgoodw, the best advice I can do is just play with the settings of '' mouse. '' Just type mouse into the start menu.
By default, a Synaptics touchpad has a vertical scroll box to the right of the touchpad. Some versions of pilot also (default) enable the horizontal scroll down box.
Both can be changed to enabled, amount of space used, where they are, speed of scrolling and much more in the config of Synaptics. You would be pleasantly surprised how you can set one up. ;)HTH,
Chris [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.] -
I would like to know how to remove the box/cursor information dialog box that appears whenever I have stop my mouse on an object.
Have you tried to uncheck both options via Control Panel / folder Options / View?
"Displays the size of file in folder tips".
"Display descriptions pop - up for folder and desktop items"
-
How to assign URLs dynamically using button/link on the page of peoplesoft? Please provide detailed instructions.
1. define the URL, the Z_URL1 or the Z_URL2 definitions
2. in the change of field button:
If true Condition then
ViewURL (URL. Z_URL1);
On the other
ViewURL (URL. Z_URL2);
End - if
-
How to find the dynamic inside the af acomponent ID: foreach?
Hi friends,
Jdev: 11.1.1.7
I have a requirement like I need a list of books available as links. So I posted using af: foreach and inside I used af:goLink.
I need to display the ToolTip on mouseover this link. To display the ToolTip, I used the popup. How to find the dynamic ID inside the af: foreach in java.
If I bind the comonent, it does not work inside foreach.
Try this way, root.findComponent("r1:it2"); it is in taskflow. On popufetchlistener you call a method to get the id of the component to get the book desc.
Thank you
Hello
You can probably assign a customer attribute for elements and then using that you could get the values?
Check out https://docs.oracle.com/cd/E21764_01/apirefs.1111/e12419/tagdoc/af_clientAttribute.html and http://jdevadf.oracle.com/adf-richclient-demo/faces/components/clientAttribute.jspx
Arun-
-
By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?
Create a text field and use the option 'comb n characters.
-
My text box is frozen and has a dotted around her line, how can I get the cursor inside?
My text box is frozen and has a dotted around her line, how can I get the cursor inside? I work in Indesign CS3, I wrote a page of A4 format with a unique and with a large amount of text inside text box. In the end, I brought a JPEG in the page. Now they have a thin line dotted around them and appear "frozen." I have not seen the dotted line instead of the line before usual text box.
Points: The text box is not locked, the layer is not locked. Nothing on the page goes live with command + A to select.
It happened between the Time Machine backups so that I can not restore.
All I need are the captured keystrokes.
What can happen when you put the JPEG, I myself can I have moved that file folder, a larger file, on the desktop, then placed the JPEG.
Re-opening Indesign didn't work; restart did not work.
Solutions appreciated.
The dotted lines mean that your items are on a master page and not a document page.
-
Using using Cluase for dynamic cursors using Bind Variables.
Hello
I have a quick question. I build dynamic cursor depends on the setting. The one here is my common charly.
I use the 5 parameter in place several in my query. So, I use almost 40 values if I used with would adopt it. Is there another way to manage rather than spend 40 times.
Appreciated your help.SELECT decode(GROUPING(nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''), nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''), nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))), '1', 'Total', nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''), nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''), nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))) NAME, SUM(kpi), ..... from tb_test1,... where WHERE upper(nvl(LVL1, ''UNKNOWN'')) = upper(nvl(p_level1, LVL1)) AND upper(nvl(LVL2, ''UNKNOWN'')) = upper(nvl(p_level2, LVL2)) AND upper(nvl(LVL3, ''UNKNOWN'')) = upper(nvl(p_level3, LVL3)) AND upper(nvl(LVL4, ''UNKNOWN'')) = upper(nvl(p_level4, LVL4)) AND upper(nvl(LVL5, ''UNKNOWN'')) = upper(nvl(p_level5, LVL5)) AND upper(nvl(LVL6, ''UNKNOWN'')) = upper(nvl(p_level6, LVL6)) GROUP BY ROLLUP(nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''), nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''), nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))) ORDER BY nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''), nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''), nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))));
Kind regards
Vincent.Just capture once inside SQL, then use local versions of their
for example
with t as (select p_level1 as pl1 ,p_level2 as pl2 ,p_level3 as pl3 ,p_level4 as pl4 ,p_level5 as pl5 from dual) SELECT decode(GROUPING(nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''), nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''), nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))), '1', 'Total', nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''), nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''), nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))) NAME, SUM(kpi), ..... from t, tb_test1,... where WHERE upper(nvl(LVL1, ''UNKNOWN'')) = upper(nvl(pl1, LVL1)) AND upper(nvl(LVL2, ''UNKNOWN'')) = upper(nvl(pl2, LVL2)) AND upper(nvl(LVL3, ''UNKNOWN'')) = upper(nvl(pl3, LVL3)) AND upper(nvl(LVL4, ''UNKNOWN'')) = upper(nvl(pl4, LVL4)) AND upper(nvl(LVL5, ''UNKNOWN'')) = upper(nvl(pl5, LVL5)) AND upper(nvl(LVL6, ''UNKNOWN'')) = upper(nvl(p_level6, LVL6)) GROUP BY ROLLUP(nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''), nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''), nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))) ORDER BY nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''), nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''), nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))));
Maybe you are looking for
-
This is the error I get when I try to send an eCard from 123Greetings.com (for example) via the FACEBOOK button. Now, I also noticed that lately I can't sign in through Facebook Web sites (like when a Web site you give a choice to connect or click on
-
Need the drivers NVidia for Qosmio G20 because of problem of Second Life
Nobody knows when the latest drivers will be ready or if they are already to the G20. I am up and works well with those who is downloaded from Windows Update, yet I can't get Second life, work on my G20 and there seems to be a video driver issue. I c
-
Continuously monitor changes to a string value.
Hello world I am looking for a solution to this issue. More info: I have a dialogue-type VI with only a text field, which is a string. The user needs to analyze a Data-Matrix Code from a device in the chain. The scanner itself works as if the user ha
-
Curve adjustment not linear need help
I need help, try to fit a set of data that require the use of a non-linear curve. I have attached a txt file that contains the data that must be mounted. The first line contains the values of the x axis, while the second line contains the values of
-
driver CD and dvd cannot recognize
Well, if anyone can help me I'll apreciate... my loptop computer do not recognize cd and DVDs an i don't know how to reprogram...