Cannot generate the dynamic query - ora-06502
Hi friends,
during execution of code below I get the error message: ora-06502 pl/sql numeric or value error on line 11
I'm not able to open a SQL session table logging.
DECLARE
T_Participants TYPE TABLE IS NUMBER;
c_Participant_Id t_Participants: = t_Participants();
CLOB V_SQL;
BEGIN
Select the participantid COLLECT in BULK IN c_Participant_Id in t_roster_detail
where rosterid = 10654
and ba = "MD";
I'm IN 1.c_Participant_Id.COUNT LOOP
V_SQL: = V_SQL | "SELECT p.participantid,.
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10331, p.Current_Data, NULL), null) "10331_CURRENT."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10331, p.Goal_Data, NULL), null) "10331_Goal."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 9640, p.Current_Data, NULL), null) "9640_CURRENT."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 9640, p.Goal_Data, NULL), null) "9640_Goal."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 9643, p.Current_Data, NULL), null) "9643_CURRENT."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 9643, p.Goal_Data, NULL), null) "9643_Goal."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10332, p.Current_Data, NULL), null) "10332_CURRENT."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10332, p.Goal_Data, NULL), null) "10332_Goal."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10721, p.Current_Data, NULL), null) "10721_CURRENT."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10721, p.Goal_Data, NULL), null) "10721_Goal."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10701, p.Current_Data, NULL), null) "10701_CURRENT."
Decode (p.Participantid, ' | c_Participant_Id (i) |', decode (p.Measureid, 10701, p.Goal_Data, NULL), null) '10701_Goal '.
OF t_sce_msr_output_data p
WHERE IN (SELECT T_PC_AXIS_DEFINITION CREATES CREATES
WHERE PLANCOMPONENTID IN (SELECT PLANCOMPONENTID FROM T_PLAN_COMPONENT WHERE PLANID = 10702))
UNION ";
END LOOP;
DELETE FROM T_LOGGING_SQL;
INSERT INTO T_LOGGING_SQL VALUES (V_SQL);
COMMIT;
END;
SQL > desc t_sce_msr_output_data
Name Null? Type
----------------------------------------- -------- ------------
IDSCENARIO NOT NULL NUMBER
CREATES NOT NULL NUMBER
PARTICIPANTID NOT NULL NUMBER
NUMBER OF BASELINE_DATA
NUMBER OF CURRENT_DATA
NUMBER OF GOAL_DATA
You are way more complicate things here. First of all, there is no need at all for dynamic sql because the wy you are querying is incorect.
Even if you do not have an error, which you query will do is run the query on t_sce_msr_output_data once for each row returned by the cursor. Each iteration of the query will return all matching rows (i.e. lines for all the participantid in the t_sce_msr_output_data table), then the external decoding will be will force all other NULL columns for all the participantid that do not correspond to the "current" participantid
The query can be simplified to:
Select p.participantid,
Decode (p.Measureid, 10331, p.Current_Data, NULL) "10331_CURRENT."
Decode (p.Measureid, 10331, p.Goal_Data, NULL) "10331_Goal."
Decode (p.Measureid, 9640, p.Current_Data, NULL) "9640_CURRENT."
Decode (p.Measureid, 9640, p.Goal_Data, NULL) "9640_Goal."
Decode (p.Measureid, 9643, p.Current_Data, NULL) "9643_CURRENT."
Decode (p.Measureid, 9643, p.Goal_Data, NULL) "9643_Goal."
Decode (p.Measureid, 10332, p.Current_Data, NULL) "10332_CURRENT."
Decode (p.Measureid, 10332, p.Goal_Data, NULL) "10332_Goal."
Decode (p.Measureid, 10721, p.Current_Data, NULL) "10721_CURRENT."
Decode (p.Measureid, 10721, p.Goal_Data, NULL) "10721_Goal."
Decode (p.Measureid, 10701, p.Current_Data, NULL) "10701_CURRENT."
Decode (p.Measureid, 10701, p.Goal_Data, NULL) '10701_Goal '.
of t_sce_msr_output_data p
where in (select creates creates
of t_pc_axis_definition
where plancomponentid in (select plancomponentid
of t_plan_component
where planid = 10702)) and
participantid in (select participantid
of t_roster_detail
where rosterid = 10654 and
BA = "MD");
You probably want to pivot these results by participant, if so look in the note from the FAQ for the columns of the rows.
John
Tags: Database
Similar Questions
-
After migrating my APEX 4.1 application to a new environment, one classic report displays a "cannot parse the SQL query: ORA-00942: table or view does not exist" error when the page is displayed. Change the region to report SQL source to somehow (e.g., remove spaces, changing the order of the variables in the WHERE clause) immediately solves the problem, but by returning to the source of the region causes the report error again (the source region valid code without error, however).
Throw the error message:
Select v.id,
v.Col1
of view_vw v
where (: P1_FILTER is null or)
v.col2 = :P1_FILTER)
Do not throw error:
Select v.id,
v.Col1
of view_vw v
where (:P1_FILTER is null or)
v.col2 = :P1_FILTER)
Changing the order of column in the report has the same effect; i.e. He arranges, but return back to the original column order causes the error to display.
It's as if a cached result for the correct select statement used by the report is displayed. However, the application does not use the caching of page/region. Any ideas of what could be the cause?
He solved. Ultimately, all that was necessary was to clear the DB cache using:
alter system flush shared_pool;
-
Collection of the dynamic query
Hi All-
I'm trying to get the value of the collection through the dynamic query but I am facing some problem please let me know that I hurt.
Created a function like below to run the dynamic query to select statement
create or replace FUNCTION rfunGetColumnValue ( ColumnName VARCHAR2, TableName VARCHAR2, DefaultValue OUT VARCHAR2, Criteria VARCHAR2) RETURN VARCHAR2 IS ReturnValue VARCHAR2 (32767 byte) ; Stmt VARCHAR2 (32767 byte) ; BEGIN stmt := 'begin select '|| ColumnName || ' into :1 from table(:2) ' ||NVL ( Criteria, ' ') || ' Fetch First Row only ; EXCEPTION WHEN OTHERS THEN :2 := SQLERRM; end;' ; dbms_output.put_line (stmt) ; EXECUTE IMMEDIATE stmt USING OUT ReturnValue, OUT DefaultValue; --select Valueinto into Returnvalue from dual; RETURN ReturnValue; END;
Now, I created a folder in the Package
create or replace PACKAGE Collection_PKG is type Bank_rec is RECORD ( SNO NUMBER(10), BANKID NUMBER(5), BANKNAME VARCHAR2(50), BANKSC VARCHAR2(50), ADDEDIT varchar2(1), COMPID number(5), ISBULK number(1), ROWNO number(10), ERROR VARCHAR2(500) ); TYPE Bank_tbl IS TABLE OF Bank_rec; --type Bank_cur is ref cursor return Bank_rec; end Collection_PKG; end Collection_PKG; end Collec tion_PKG;
Now, when I'm Trying the code below
DECLARE V_EXECQUERYPARAM XMLTYPE:= XMLTYPE('<QueryParam> <BankXML> <Bank> <BankID>0</BankID> <BankSC><![CDATA[RCB]]></BankSC> <BankName><![CDATA[Royal challenger Bank]]></BankName> <IsBulk>0</IsBulk> <AddEdit>A</AddEdit> </Bank> </BankXML> </QueryParam>'); BEGIN Rspbanksave( v_SPParamList => V_EXECQUERYPARAM ); END;
create or replace PROCEDURE rspBankSave ( v_SPParamList XMLTYPE DEFAULT NULL) IS V_Addedit VARCHAR2 (1 CHAR) ; Bank_tbl Collection_PKG.BANK_TBL := Collection_PKG.BANK_TBL () ; BEGIN SELECT Row_number () OVER (ORDER BY 1), XT.BankID, XT.BankName, XT.BankSC, XT.AddEdit, v_CompID, XT.IsBulk, CAST (0 AS NUMBER (5)), CASE WHEN MBank.BankID IS NOT NULL THEN CASE WHEN XT.BankSC = MBank.BankSC AND XT.BankName = MBank.BankName THEN 'R104|Entry Already Exist,R114|Short Code Already Exist' WHEN XT.BankSC = MBank.BankSC THEN 'R114|Short Code Already Exist' WHEN XT.BankName = MBank.BankName THEN 'R104|Entry Already Exist' END ELSE NULL END Bulk collect INTO Bank_tbl FROM XMLTABLE ('//QueryParam/BankXML/Bank' PASSING v_SPParamList COLUMNS BankID NUMBER (5) PATH 'BankID', BankName VARCHAR2 ( 50) PATH 'BankName', BankSC VARCHAR2 ( 50) PATH 'BankSC', AddEdit VARCHAR2 ( 1) PATH 'AddEdit', IsBulk NUMBER (1) PATH 'IsBulk') XT LEFT JOIN MBank ON XT.BankID != MBank.BankID AND v_CompID = MBank.CompID AND (XT.BankSC = MBank.BankSC OR XT.BankName = MBank.BankName) ; v_TotalRowCount := SQL%ROWCOUNT; IF (v_TotalRowCount > 0) THEN BEGIN V_Addedit:=rfunGetColumnValue (ColumnName=> 'Upper(AddEdit)',TableName=>'table(Bank_tbl)',DefaultValue=>'',Criteria =>''); END; --SQL Code here END IF; END rspBankSave;
As I've suggested before:
To get the name of the table the column
and as others have:
Type global temporary Tables vs. table
If you give more context, more information about the bigger picture, more information about what you're trying to do and why you're going down the road you go down, you can return more useful information. But you seem reluctant to do.
For the moment, your recent posts seem to just raise the same type of question - why are you doing this?
The normal way to return data to a client is a refcursor.
It is the most effective way.
Not through collections that you seem to be put on the must-do approach.
-
I wonder why the dynamic value query is executed before the boot process? Logically, it makes sense to run after them.
For example, I test a stored procedure that is supposed to delete a record, and I'd like to create this test report should be deleted as part of the startup process before execution of the stored procedure call to delete this test record. Apparently the dynamic query of value not returns not the test report in as long as the query parameter to call the stored procedure under test, which makes me think that is executed before the startup process of design...
Please advise...
Thank you
Val
As this thread does no traction/attention of the team of SQL Developer for a while, I had to submit a request for formal improvement on metalink:
RE: 19834977 - IN THE UNIT TEST REQUEST TO ALLOW TO CHANGE THE ORDER OF EXECUTION OF THE START OF THE PROCESS
Thank you
Val
-
Cannot generate the thumbnail on all widgets (including integrated)
My installation of Muse (2014.2, OSX Mavericks) gives me a "cannot generate the thumbnail" error one no matter what widget I place (including built-in ones, my own and those that I downloaded from the site of Muse documentation on github).
So far, I have tried many things including restart Muse, reboot the machine, turn off all browsers in the background, but I can not change this behavior.
This problem is specific to the machine, I'm getting because the same site on the exact version on another machine (os x mavericks) does not give me this behavior.
Any help is appreciated.
Thank you
A.Solved. While this problem appeared machine related, it wasn't - it turns out that I had added a js file in my page header that was missing.
So, the moral of this story is that if you do not see the "unable to generate thumbnail error", look at all the custom HTML you added to the site. Errors in the HTML elements may appear in the wrong place.
A.
-
Internal error detected, cannot generate the eBook (11 Robohelp)
Hello
I'm new to Robohelp (I've been a user long term of Framemaker for print publications).
The generation of Ebook of the carrycot single Source Layout has stopped working and I get this message: internal error detected, cannot generate the eBook (11 Robohelp eBook preprocessor 11.0.0.179)
Compilation G:\Development\Course Development\CONE-online\Characteristics-of-light\Robohelp\Characteristics-of-light\Charac light\ Ta! SSL! \eBook\! epub_tmp_folder_0\Characteristics_of_light. EPUB...
Preparation create eBook...
Compensation output folder...
Preparation of files for eBook...
Copying files...
Updating files...
Finish the preparation in 4 seconds
Initializing the compiler...
Generation of output - eBook eBook Manager (11.0.2.240)...
Transforming XHTML topics...
About XHTML preparation "Questions_about_light.xhtml"...
About XHTML preparation "The_Electromagnetic_Spectrum.xhtml"...
Preparation of subject XHTML ' Using_wave_properties/Interferometry.xhtml '...
Preparation of subject XHTML ' Using_wave_properties/Mach - Zehnder_modulators.xhtml '...
Preparation of subject XHTML "Using_wave_properties/The-wave-properties-of - light .xhtml"...
Preparation of subject XHTML ' Wavelengths_and_Frequencies_in_optical_networks/ITU_bands.xhtml '...
Preparation of subject XHTML ' Wavelengths_and_Frequencies_in_optical_networks/Light_sources_and_wavelengths.xhtml '...
Preparation XHTML topic ' Wavelengths_and_Frequencies_in_optical_networks/Wavelengths_and_Frequencies_in_fibre_opt ics.xhtml '...
Preparing to Table of contents...
Output EPUB 3...
EPUB 3 output generation failed.
Internal error occur, could not generate the eBook.
Could someone give me advice on what to do to fix? What have I done? I tried to install Adobe digs Eds 4 and it seems stop working after that, but I tried to uninstall that and it is always the same. I also tried to reinstall TCS5. Reactive out of HTML5 still works ok.
Thanks in advance,
Sarah
It could be a longshot, but try to move the project to a place where the path is shorter. I had a similar problem (I think I got the same error a few months ago, but I can't be 100% certain), where the epub was not able to generate, and I tried to move my project to another location where the path to the files was shorter. This solves the problem for me.
-
Cannot generate the Word .doc
100 classic page chm project compiles successfully. You will need to create the document Word for graphic designer do a nice .pdf. Get warnings (style not defined, mapped to normal). Can not find the style not defined in the code, but see some class = msonormal elements. Then, I get error "Word Document became corrupted when you attempt to add a topic malformed". Then, RoboHelp is unable to deal with a subject. Then it has Fatal Error "Word Document got corrupted" and she is abandoned. A little more of these erros and he cannot generate the rest of the Word document.
Cannot search this forum for "malformed", either. Get a "Variable FTVAR_RESULTTYPE is undefined." Message.
Cannot find the whole chain, but the deletion of any reference MSObookmark did the trick, thanks
-
Is any idea available in the process of disassembly of the table or restore the line to line 22?
I see a bunch of discussions on the subject, but no clear solution/answer...
What could be the causes of this error?
I had two process of disassembly on the level now, and one of them had failed with this error. Displacement of the failure of the process of disassembly compared to the level of the suite for the level of performance of test unit solved the error for a while, but after some more dragging the process of disassembly of the table (with about 500 cases) is permanent.
Please advise...
Thank you
Val
Well, had to create a bug officially... I hope this helps...
Bug 19696042 : UNIT TEST: disassembly of THE TABLE or LINE RESTORE failed: ORA-06502: STRING BUFFER TOO SMA
Thank you
Val
-
Cannot create the ASM Diskgroup ORA 15020 and ORA-15018
Hello team,
Could not create the ASM diskgroup with the following error:
SQL > create diskgroup redundancy data_asm1 external disk ' / dev/sdf *;
create diskgroup redundancy data_asm1 external disk ' / dev/sdf. "
*
ERROR on line 1:
ORA-15018: diskgroup cannot be created.
ORA-15020: discovered in double disc ASM 'DATA_ASM1_0000 '.
ASM Diskstring
SQL > show parameter asm_diskstring
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
asm_diskstring string/dev/oracleasm/disks/DISK *, /dev / sd *
Please let me know how to solve this problem
Kind regards
Hello
check your disc diskgroup status grid +. display result
1 res ora of $ crsctl State. GRID.dg or $ crsctl status res ora.grid.dg
Note the distinction uppercase / lowercase of the crs resource
2. run below as a user of the grid. (necessary to set SID = + ASM? If not already preset)
ASMCMD > lsdg
Tobi
-
Cannot generate the main Layout, invalid media error
Hello
I am currently using Robohelp x 5. I get the error, "invalid media. Cannot create the Y:\JUSTIN\AwareHelpStage file", when I try to generate the main layout for my project. Does anyone have an overview of what could be the problem?
Also, when I go to, file-> generate primary layout and change the output folder. I get a different error, 'Please select a new subfolder of the project or folder out of the path of the project'.
I do not have a "Y:\. "on my computer or, at least, when I try to make my computer can't find it.
I have 95% connections and only a few .png in my project. Could be the error media that this is a reference?
I changed the name of my .xpj, about 70% of the way the project, that it was by. I'm not sure, if I tried to generate a main page layout because I changed the name. Could there be some kind of confusion in the system when it is trying to produce the layout because of this? The reason why I ask, because it asks the name of my project, the name in the text box 'Project name', when I go to file-> generate a main page layout.
Thanks for your time,
Ben
Hello
There seems to me to refer to a network location.
I might suggest you right click on your unique Layouts of Source folder and create a totally fresh provision. Leave the path to the output folder because it is in the new provision. See if that solves nothing.
See you soon... Rick
Useful and practical links
-
Cannot generate the schema help
Hi all
I am facing a problem, try to generate a WebHelp primary schema, when I click on the "Main Layout View" buttons or "generate primary Layout." nothing happens. I use RoboHelp 7 with MS Office Word 2007.
I'm working on 2 projects, and what happens in one project only, so I think it's perhaps something in the file format!
I also noticed that when I click button 'save' and then try to close the word document, an apears confirmation message that I have to save first, when I click on save and try to close the file word; the confirmation message appears once again, the only action that allows me to close the file is click 'No' to the backup dialog box.There is a thread where a few Adobe RoboHelp for Word 7 users have reported that they cannot save the changes or generate output. The issue has been isolated to the RHComAdd.DLL be disabled.
What to look for in Word
-For versions 2003, go to help | Everything | Disabled items. If RHComAdd.DLL display, re - enable.
-For Word 2007, click on Office button | Resources | Everything | Macros complementary. Under 'Manage', select disabled items. If RHComAdd.DLL display, re - enable.
-
How to set the result of the dynamic query in a refcursor ON param.
Hello
I created the following package.
CREATE OR REPLACE package LGIS
Is
Type T_Cust_Acct_Arr is table of number;
Type Invc_Base_Rec_Type is (Record
Invoice_Control_No Customer_History.Invoice_Control_No%Type,
Billing_Cycle_Id Eb_Oor_Cust_Online.Billing_Cycle_Id%Type,
Bill_Cycl_Occr_No Eb_Oor_Cust_Online.Bill_Cycl_Occr_No%Type,
Invoice_Dt Bill_Cycl_Occr_Inf.Invoice_Date%Type,
Invc_Acct_Id Eb_Oor_Cust_Online.Customer_Acct_Id%Type,
Acct_Id Eb_Oor_Cust_Online.Customer_Acct_Id%Type
);
Type Invc_Base_Refcur_Type is Ref Cursor
Return Invc_Base_Rec_Type;
Procedure P_Get_Approved_Whole_Invcs)
In_From_Invc_Dt by Date,
In_To_Invc_Dt by Date,
In_Cust_Acct_List in T_Cust_Acct_Arr,
Out_Eb_Invcs on Invc_Base_Refcur_Type
On_Error_No number
);
End LGIS;
/
CREATE OR REPLACE PACKAGE BODY Lgis
IS
PROCEDURE P_Get_Approved_Whole_Invcs)
In_From_Invc_Dt BY DATE,
In_To_Invc_Dt BY DATE,
In_Cust_Acct_List IN T_Cust_Acct_Arr,
Out_Eb_Invcs on Invc_Base_Refcur_Type
On_Error_No NUMBER
)
IS
S_Query VARCHAR2 (4000);
Invalid_Exception EXCEPTION;
BEGIN
On_Error_No: = 0;
IF In_Cust_Acct_List.COUNT > 0 THEN
FORALL i IN 1.In_Cust_Acct_List.COUNT
INSERT INTO EB_CUST_ACCT_WHOLE_TMP (Cust_Acct_Val)
VALUES (In_Cust_Acct_List (i));
END IF;
BEGIN
S_Query: = 'Select Ch.Invoice_Control_No,';
S_Query: = S_Query | ' Eoco.Billing_Cycle_Id,';
S_Query: = S_Query | ' Eoco.Bill_Cycl_Occr_No,';
S_Query: = S_Query | ' Bcoi.Invoice_Date,';
S_Query: = S_Query | ' Eoco.Customer_Acct_Id as Invc_Acct_Id';
S_Query: = S_Query | ' Eoco.Customer_Acct_Id as Acct_Id ';
S_Query: = S_Query | "Of Eb_Oor_Cust_Online Eoco,';
S_Query: = S_Query | "Customer_History Ch';
S_Query: = S_Query | ' Bcoi Bill_Cycl_Occr_Inf,';
S_Query: = S_Query | "Audit_Var_Log Avl,';
S_Query: = S_Query | "Audit_Var_Def Avd,';
S_Query: = S_Query | "Eb_Cust_Acct_Whole_Tmp Tmp';
S_Query: = S_Query | "Where Avd.Audit_Var_Cd ="CYCLE_APPROVAL"';
S_Query: = S_Query | ' And Avl.Audit_Var_Sub_Grp_Val = 0';
S_Query: = S_Query | "And Avl.Audit_Var_Char_Val =" COMPLETE "';
S_Query: = S_Query | ' And Eoco.Customer_Acct_Id = Tmp.Cust_Acct_Val';
S_Query: = S_Query | ' And Eoco.Customer_Acct_Id = Ch.Customer_Acct_Id';
S_Query: = S_Query | ' And Eoco.Billing_Cycle_Id = Ch.Billing_Cycle_Id';
S_Query: = S_Query | ' And Eoco.Bill_Cycl_Occr_No = Ch.Bill_Cycl_Occr_No';
S_Query: = S_Query | ' And Eoco.Billing_Cycle_Id = Bcoi.Billing_Cycle_Id';
S_Query: = S_Query | ' And Eoco.Bill_Cycl_Occr_No = Bcoi.Bill_Cycl_Occr_No';
S_Query: = S_Query | ' And Avd.Audit_Var_Id = Avl.Audit_Var_Id';
S_Query: = S_Query | ' And Avl.Audit_Var_Grp_Id = Bcoi.Audit_Var_Grp_Id';
IF (In_From_Invc_Dt IS NULL AND In_To_Invc_Dt IS NOT NULL) THEN
S_Query: = S_Query | "And Bcoi.Invoice_Date < = In_To_Invc_Dt';
END IF;
IF (In_To_Invc_Dt IS NULL AND In_From_Invc_Dt IS NOT NULL) THEN
S_Query: = S_Query | ' And Bcoi.Invoice_Date > = In_From_Invc_Dt';
END IF;
IF (In_From_Invc_Dt IS NOT NULL AND In_To_Invc_Dt IS NOT NULL) THEN
S_Query: = S_Query | ' And Bcoi.Invoice_Date > = In_From_Invc_Dt';
S_Query: = S_Query | "And Bcoi.Invoice_Date < = In_To_Invc_Dt';
END IF;
RUN IMMEDIATELY S_Query IN Out_Eb_Invcs;
EXCEPTION
WHILE OTHERS THEN
On_Error_No: = - 1;
RAISE Invalid_Exception;
END;
Exception
When Invalid_Exception then
On_Error_No: = - 1;
Return;
While others then
On_Error_No: = - 1;
END P_Get_Approved_Whole_Invcs;
Lgis END;
/
It compiles without error. But at runtime, I get the following error:
ORA-06504: PL/SQL: return variables of the game results or the query types do not match
Please help solve this problem.
Thank you
OlivierMaybe it will work for you too->
CREATE OR REPLACE Package Body Lgis Is Procedure P_Get_Approved_Whole_Invcs ( In_From_Invc_Dt In Date, In_To_Invc_Dt In Date, In_Cust_Acct_List In T_Cust_Acct_Arr, Out_Eb_Invcs Out Invc_Base_Refcur_Type, On_Error_No Out Number ) Is S_Query Varchar2(4000); Invalid_Exception Exception; Begin On_Error_No := 0; If In_Cust_Acct_List.Count > 0 Then Forall I In 1..In_Cust_Acct_List.Count Insert Into Eb_Cust_Acct_Whole_Tmp (Cust_Acct_Val) Values (In_Cust_Acct_List (I)); End If; Begin S_Query := ' Select Ch.Invoice_Control_No Invoice_Control_No, ' ||' Eoco.Billing_Cycle_Id Billing_Cycle_Id, ' ||' Eoco.Bill_Cycl_Occr_No Bill_Cycl_Occr_No, ' ||' Bcoi.Invoice_Date Invoice_Dt, ' ||' Eoco.Customer_Acct_Id As Invc_Acct_Id,' ||' Eoco.Customer_Acct_Id As Acct_Id ' ||' From Eb_Oor_Cust_Online Eoco, ' ||' Customer_History Ch, ' ||' Bill_Cycl_Occr_Inf Bcoi, ' ||' Audit_Var_Log Avl, ' ||' Audit_Var_Def Avd, ' ||' Eb_Cust_Acct_Whole_Tmp Tmp ' ||' Where Avd.Audit_Var_Cd = '||chr(39)||'CYCLE_APPROVAL'||chr(39) ||' And Avl.Audit_Var_Sub_Grp_Val = 0 ' ||' And Avl.Audit_Var_Char_Val = '||chr(39)||'COMPLETE'||chr(39) ||' And Eoco.Customer_Acct_Id = Tmp.Cust_Acct_Val ' ||' And Eoco.Customer_Acct_Id = Ch.Customer_Acct_Id ' ||' And Eoco.Billing_Cycle_Id = Ch.Billing_Cycle_Id ' ||' And Eoco.Bill_Cycl_Occr_No = Ch.Bill_Cycl_Occr_No ' ||' And Eoco.Billing_Cycle_Id = Bcoi.Billing_Cycle_Id ' ||' And Eoco.Bill_Cycl_Occr_No = Bcoi.Bill_Cycl_Occr_No ' ||' And Avd.Audit_Var_Id = Avl.Audit_Var_Id ' ||' And Avl.Audit_Var_Grp_Id = Bcoi.Audit_Var_Grp_Id ' If (In_From_Invc_Dt Is Null And In_To_Invc_Dt Is Not Null) Then S_Query:=S_Query||' And Bcoi.Invoice_Date <= In_To_Invc_Dt '; End If; If (In_To_Invc_Dt Is Null And In_From_Invc_Dt Is Not Null) Then S_Query:=S_Query||' And Bcoi.Invoice_Date >= In_From_Invc_Dt '; End If; If (In_From_Invc_Dt Is Not Null And In_To_Invc_Dt Is Not Null) Then S_Query:=S_Query||' And Bcoi.Invoice_Date >= In_From_Invc_Dt ' ||' And Bcoi.Invoice_Date <= In_To_Invc_Dt '; End If; Dbms_Output.Put_Line ('Test'); Open Out_Eb_Invcs For S_Query; Dbms_Output.Put_Line ('Test1'); Loop Fetch Out_Eb_Invcs Into Ibrt_Type; Exit When Out_Eb_Invcs%notfound; Dbms_Output.Put_Line ('Invoice_Control_No: ' || Ibrt_Type.Invoice_Control_No); Dbms_Output.Put_Line ('Billing_Cycle_Id: ' || Ibrt_Type.Billing_Cycle_Id); Dbms_Output.Put_Line ('Bill_Cycl_Occr_No: ' || Ibrt_Type.Bill_Cycl_Occr_No); Dbms_Output.Put_Line ('Invoice_Dt: ' || Ibrt_Type.Invoice_Dt); Dbms_Output.Put_Line ('Invc_Acct_Id: ' || Ibrt_Type.Invc_Acct_Id); Dbms_Output.Put_Line ('Acct_Id: ' || Ibrt_Type.Acct_Id); End Loop; Dbms_Output.Put_Line ('Test2'); Close Out_Eb_Invcs; /* Exception When Others Then On_Error_No := -1; Raise Invalid_Exception; */ End; Exception When Invalid_Exception Then On_Error_No := -1; Return; /* When Others Then On_Error_No := -1; */ End P_Get_Approved_Whole_Invcs; End Lgis;
Your problem is now fixed.
Kind regards.
LOULOU.
-
Get the dynamic query alias name
Hi all
I have a plsql function using a dynamic query.
And the function takes an entire sql query as a parameter.
The main problem is that the function must get what aliases or columns were interviewed.
For example,.
FUNCTION_GET_QUERY_ALIAS ('SELECT 1 AS col1, col2 FROM DUAL 2 AS')
Inside the function, he must find the alias name COL1 and COL2.
I would be grateful for any help.I modified print_table as fact and function to meet your needs.
SQL> CREATE OR REPLACE TYPE my_column_object AS OBJECT(ruw_number integer, column_name VARCHAR2(1000), column_val VARCHAR2(1000)) 2 / Type created. SQL> CREATE OR REPLACE TYPE my_table_type AS TABLE OF my_column_object 2 / Type created. SQL> CREATE OR REPLACE FUNCTION print_table( p_query in varchar2 ) RETURN my_table_type PIPELINED 2 AS 3 l_theCursor INTEGER DEFAULT DBMS_SQL.OPEN_CURSOR; 4 l_columnValue VARCHAR2(4000); 5 l_status INTEGER; 6 l_descTbl DBMS_SQL.DESC_TAB; 7 l_colCnt NUMBER; 8 l_rcount INTEGER := 0; 9 BEGIN 10 DBMS_SQL.PARSE( l_theCursor, p_query, dbms_sql.native ); 11 12 DBMS_SQL.DESCRIBE_COLUMNS( l_theCursor, l_colCnt, l_descTbl ); 13 14 FOR i IN 1 .. l_colCnt 15 LOOP 16 DBMS_SQL.DEFINE_COLUMN(l_theCursor, i, l_columnValue, 4000); 17 end loop; 18 19 l_status := DBMS_SQL.EXECUTE(l_theCursor); 20 21 WHILE ( DBMS_SQL.FETCH_ROWS(l_theCursor) > 0 ) 22 LOOP 23 l_rcount := l_rcount + 1; 24 FOR i IN 1 .. l_colCnt 25 LOOP 26 DBMS_SQL.COLUMN_VALUE( l_theCursor, i, l_columnValue ); 27 28 PIPE ROW(my_column_object(l_rcount,l_descTbl(i).col_name,l_columnValue)); 29 END LOOP; 30 END LOOP; 31 32 RETURN; 33 end; 34 / Function created. SQL> select * from table(print_table('select * from emp')) 2 / RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 1 EMPNO 7369 1 ENAME SMITH 1 JOB CLERK 1 MGR 7902 1 HIREDATE 17-DEC-80 1 SAL 800 1 COMM 1 DEPTNO 20 1 DIV 10 2 EMPNO 7499 2 ENAME ALLEN RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 2 JOB SALESMAN 2 MGR 7698 2 HIREDATE 20-FEB-81 2 SAL 1600 2 COMM 300 2 DEPTNO 30 2 DIV 10 3 EMPNO 7521 3 ENAME WARD 3 JOB SALESMAN 3 MGR 7698 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 3 HIREDATE 22-FEB-81 3 SAL 1250 3 COMM 500 3 DEPTNO 30 3 DIV 10 4 EMPNO 7566 4 ENAME JONES 4 JOB MANAGER 4 MGR 7839 4 HIREDATE 02-APR-81 4 SAL 2975 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 4 COMM 4 DEPTNO 20 4 DIV 10 5 EMPNO 7654 5 ENAME MARTIN 5 JOB SALESMAN 5 MGR 7698 5 HIREDATE 28-SEP-81 5 SAL 1250 5 COMM 1400 5 DEPTNO 30 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 5 DIV 10 6 EMPNO 7698 6 ENAME BLAKE 6 JOB MANAGER 6 MGR 7839 6 HIREDATE 01-MAY-81 6 SAL 2850 6 COMM 6 DEPTNO 30 6 DIV 10 7 EMPNO 7782 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 7 ENAME CLARK 7 JOB MANAGER 7 MGR 7839 7 HIREDATE 09-JUN-81 7 SAL 2450 7 COMM 7 DEPTNO 10 7 DIV 10 8 EMPNO 7788 8 ENAME SCOTT 8 JOB ANALYST RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 8 MGR 7566 8 HIREDATE 19-APR-87 8 SAL 3000 8 COMM 8 DEPTNO 20 8 DIV 10 9 EMPNO 7839 9 ENAME KING 9 JOB PRESIDENT 9 MGR 9 HIREDATE 17-NOV-81 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 9 SAL 5000 9 COMM 9 DEPTNO 10 9 DIV 10 10 EMPNO 7844 10 ENAME TURNER 10 JOB SALESMAN 10 MGR 7698 10 HIREDATE 08-SEP-81 10 SAL 1500 10 COMM 0 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 10 DEPTNO 30 10 DIV 10 11 EMPNO 7876 11 ENAME ADAMS 11 JOB CLERK 11 MGR 7788 11 HIREDATE 23-MAY-87 11 SAL 1100 11 COMM 11 DEPTNO 20 11 DIV 10 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 12 EMPNO 7900 12 ENAME JAMES 12 JOB CLERK 12 MGR 7698 12 HIREDATE 03-DEC-81 12 SAL 950 12 COMM 12 DEPTNO 30 12 DIV 10 13 EMPNO 7902 13 ENAME FORD RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 13 JOB ANALYST 13 MGR 7566 13 HIREDATE 03-DEC-81 13 SAL 3000 13 COMM 13 DEPTNO 20 13 DIV 10 14 EMPNO 7934 14 ENAME MILLER 14 JOB CLERK 14 MGR 7782 RUW_NUMBER COLUMN_NAME COLUMN_VAL ---------- -------------------- -------------------- 14 HIREDATE 23-JAN-82 14 SAL 1300 14 COMM 14 DEPTNO 10 14 DIV 10 126 rows selected. SQL>
Thank you
Knani.Published by: Karthick_Arp on September 23, 2008 12:11 AM
-
In trigger page, I have a message: unable to generate the thumbnail (in french because I'm french) but I guess that English would be 'impossible to generate the thumbnail' does that mean?
It's a custom widget, or embedded HTML block.
David
Creative muse
-
Cannot create the SQL query view object
I'm having a lot of trouble to create a display of a SQL object.
The query is as follows:
Select CalBruker.BRUK_ID,
CalBruker.EMAIL,
CalBruker.ETTERNAVN,
CalBruker.PASSORD,
CalBruker.DATO_OPPRETTET,
CalBruker.AKTIV,
CalBruker.FORNAVN,
CalBruker.ROLL_ROLL_ID,
CalBruker.AVDE_AVDE_ID,
CalRoller.NAVN,
CalRoller.ROLL_ID,
CalAvdelinger.NAVN AS NAVN1,
CalAvdelinger.AVDE_ID,
CalRoller.BESKRIVELSE,
CalForlag.NAVN AS NAVN2,
CalForlag.FORL_ID,
CalAvdelinger.navn,
CalForlag.navn AS BrukForlag,
CalBruker.FRIEKS_PROSENT_GRENSE,
CalBruker.LOGIN_NAVN
Of CAL_BRUKER CalBruker, CAL_ROLLER CalRoller, CAL_AVDELINGER CalAvdelinger, CAL_FORLAG CalForlag
Where CalBruker.ROLL_ROLL_ID = CalRoller.ROLL_ID AND CalBruker.AVDE_AVDE_ID = CalAvdelinger.AVDE_ID AND CalAvdelinger.FORL_FORL_ID = CalForlag.FORL_ID
If I create a new view object and paste the SQL query in there, I get no automatic attribute mappings, and I can't understand how I'm supposed to map the attributes manually.
Basically, I get a display without her attributes object.
JDeveloper version 11.1.2.0Help if you give alias names in your columns?
Something like:Select CalBruker.BRUK_ID BRUK_ID,
EMAIL CalBruker.EMAIL,
CalBruker.ETTERNAVN ETTERNAVN,
...
Maybe you are looking for
-
HP dv3-4160ee lodge for Windows 7 64-bit
nosound
-
I need to install Intel WiDi to connect new tomy smart TV, I have a HP ENVY notebook - 15 t-k200 CTO (ENERGY STAR) computer and when I try to run the WiDi software, I get the message that I need to install one of the following wireless adapters: • In
-
W510 can not put primary monitor on the right
I have a W510 in MiniDock Plus series 3. The operating system is Windows XP. I can activate my external monitor using the NVIDIA Control Panel. The page "Set Up several screens ' allows me to extend the desktop as 'A large horizontal Desktop' or 'con
-
I deleted the old address of e-mail a friend in Windows Mail and added a new. Yet, every time that I address a message to it, the old automatically pop address. How can I get to stop doing this?
-
delete the partition, volume disk empty retractable without data loss in Windows 7
When installed win 7 XP had disk c (everything on it) and F drive (empty). Need more space on the C drive. in disk management it says I can reduce F but it does not allow me to expand C. Can I delete this partition, or how to develop C? In f, he