Access the results of the dynamic query database...
CF colleagues:
I need to execute a loop of 4 times, to access the four distinct values a data offline in a test results table (tbl_results), where all four are in line with the student (WHERE studentid = etc.).
It looks like this...
< cfset variables. TimeTotals = 0 >
< cfloop from '1' to step "4" = = = '1' index = "timrec" >
< cfquery datasource = "MyDSN" name = "rs_time" >
SELECT Btime #timrec #.
OF tbl_results
WHERE studentid = 'jack '.
< / cfquery >
< cfset variables. TimeTotals = variable. TimeTotals + (? rs_time.) BTime #timrec # value?) >
< / cfloop >
QUESTION: How should I address this #timrec # value Btime? Not that way, I know, but how?
Looking forward to your wisdom, with gratitude,
Hans
There are two ways to attack this, but you're close enough. One way is to simply include a column alias in the query, and then use it to make reference to results:
SELECT Btime #timrec # LIKE feeling OF tbl_results WHERE studentid = 'jack '.
Tags: ColdFusion
Similar Questions
-
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
-
Using the function 'query-database' database
Hello
I try to use the database function "query-database.
It works fine when I give a value hardcoded in the where condition. But when I try to pass an xpath expression to the condition where it is not.
I have a flat file that contains two fields (firstname and lastname). I need read this file and write to another file with an extra field saying. roll_num I have a database table that contains three fields (firstname, lastname, and roll_num).
In the funtion of database query, I spent
"Select roll_num from the stud_details where firstname = / imp1:Root - element / imp1:Person / imp1:FIRSTNAME'.
as the value for the parameter sqlquery. This gives nothing in the output.
But when I hard code the firstname value it gives the desired result.
"Select roll_num from the stud_details where firstname = robert'-it works very well."
Please suggest if my use is wrong.
Thank you
RVIt would be good if you could post your code but generally if you and where the condition to be dynamic, you need to use the concat command that your select statement is looking for roll_num where firstname = /imp1:Root - element / imp1:Person / imp1:FIRSTNAME instead of the value of the element.
ORCL:query - database (concat ("select roll_num from the stud_details where firstname =" ", / imp1:Root - element / imp1:Person / imp1:FIRSTNAME,"'""), false (), false (), "jdbc/Db")
It gets tricky with varchar2 you need to put quotes. I tried to show in the example above.
see you soon
James -
To access the data from database to a remote computer
Hi all
Can someone tell me how to access data from a database, sitting on another computer? I use the Sqlite database. It works fine in my computer. But I don't know hoe to put the database in another computer (server) and access the data from there. In my program, it is essential to do this for a simultaneous use for different users. Someone please help.
Kind regards
Cindy.
I found the solution... http://ConnectionStrings.com/
-
access the sql server database in my widget
I just started to build widgets for blackberry in visual studio 2008 and I want to know if its possible to use data from the sql Server database server in my widget and how can I do?
You can consume data in a WebWorks app server-side. One way to do this is to build a Web Service that, when it is called from your application, queries the database and returns a list of results (for example in XML or JSON format).
You already have the data in your available through Web Services SQL Server database?
Another way is to produce a web page server that displays the data from your SQL Server database and load this web page from your application WebWorks.
-
XQuery to access the values of database.
Hello
my scenario is that I have a Tags XML A single with some data... I break these data to form another XML B with several tags using Xquery transformation. Now, I want to access the length of all the tags XML B of database as well as in the future if there is a change in length of a particular tag then I'd go to the database and change the value of the length, rather than change the code every time, but I don't know if it's possible in XQuery or not Please suggest me ways so that I can achieve.
Thank you
RahulYou can use this function in a file .xq thus (OSB). For a test to create a file of .xq that contains this function as below.
declare function TestExecuteSQL ($param1 as XS: String) as element() {}
{
FN - bea: execution-sql)
"dsjndi,"
XS:QName('elem'),
'SELECT NAME FROM TESTTABLE WHERE STATUS =?',
$param1
)}
};
declare the variable $param1 as XS: String external;TestExecuteSQL ($param1)
Now if I use this .xq in an operation attributed to the flow of messages for a proxy, the assigned variable will hold under value-
Anuj
Kind regards
Anuj -
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
-
to access the dynamic created clips
I can't access the clips for the application of measures.
photAmount, thumb1xpo, thumb1ypo and sm_photo are variables.
thumbLdr is an mc holding the mc which are created. I know that they are created as they show their respective photos. I can't apply all actions.
Thank you
THANK YOU VERY MUCH!
You and your House can be blessed.
-
Hey everyone, have a quick question. I just started using ColdFusion week last to my current job and I do a database work. One of the scripts I'm working on that is dynamically allow a user to enter information for a source of data, their username, password, database, then an operation of query-by-example-esc on this database. However a question that I am currently running shows these data. So say I got into a simple HTML form and it is passed in as the name "Colonne_1". So when I go to access my SQL statement, I'd be using:
#Form.Column_1 #.
My problem comes when I am printing these data. Normally I use the following code:
< cfoutput query = "GetResults" >
#username #.
< / cfoutput >Where # is the column #username I was looking for. How would I be able to have dynamically it out everything that needs to be entered as column name in colonne_1? So, something like:
< cfoutput query = "GetResults" >
# #Form.Column_1 # #.
< / cfoutput >Thank you!
table notation is your friend.
QueryName ["columname'] [line number]
or, in your case,
QueryName [' #variable for columname # "] [row number]
-
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.
-
How to add dynamic items based on the results of a dynamic query?
Hi all
I'm quite new to ofa, here's my problem.
I have a table 'interventions', each intervention have actions stored in the table "actions".
I want to show the actions of an intervention in a list, based on the id of the intervention. the response ID value is dynamic, so does not know the number of shares that you want to display in the list.
Can someone tell me the steps to create a region that has dynamic elements to display names of action?
Thank you
Kind regards
Afaf
Afaf,.
Take a look on the link below to see how to create dynamic VO:
You could add messageStyled text like the code below:
OAMessageStyledTextBean newMessageBean = (OAMessageStyledTextBean) createWebBean (pageContext, MESSAGE_STYLED_TEXT_BEAN, null,"
" "); Links to dynamically create elements below:
Add columns to the table advanced in OA Framework Programatically by Extension
Let us know if you get any errors when creating.
See you soon
AJ
-
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
-
Trouble accessing the dynamic XML of the API with a CFC
Please see my example at the source of http://67.199.18.39/test.html and the view (to big to post here). I'm back XML returned by a dynamic call to an API through a ColdFusion CFC.
You are looking for a generic name like dog. Click OK. I display the XML for you to see. I tried several different XMLList dataproviders but unable to get anything to work.
Can someone indicate on the 'mistakes' of my ways?
Thank you.It turns out that it was a matter of namespace. I found the answer from a tutorial of Bruce Phillips at -For-Each-Statement-And-The-Descendent-Accessor--Operator http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-in-Flex-20-Using-The
I had to add:
namespace private yahooNS = "urn: yahoo: Prods."
Using namespace yahooNS; -
How to create the table dynamically in the procedure, I tried below to how his error getting.
SQL > create or replace procedure tablecreation (tablename varchar2, varchar2 col1, col2 varchar2) is
stmt 2 varchar2 (2000);
3. start
stmt 4: = ' create table: 1 (: 2 varchar2 (20): varchar2 (20)) 3';
5. perform immediate stmt using tablename, col1, col2;
6 end;
7.
Created procedure.
SQL > exec tablecreation ('test', 'col1', 'col2');
BEGIN tablecreation ('test', 'col1', 'col2'); END;
*
ERROR on line 1:
ORA-00903: invalid table name
ORA-06512: at "SCOTT. TABLECREATION', line 5
ORA-06512: at line 1This means that the privilege is assigned to you by using a role. You must have the privilege assigned directly to the user in order to to use a procedure.
Maybe you are looking for
-
The Security Center Satellite C660, showing the poor
Hello. I have Toshiba Satellite C660 laptop. Buy 01/09/2011. I spend my computer and when I once again on I just opened Toshiba newsletter. There are health care system, Security Center showing the poor. But if 2 minutes on my computer then its good
-
iPhone in Australia of bending problem
I have two iPhones, iPad and apple TV. I bought iPhone6 and a soft case for it on the Apple Store in Sydney 6 months ago. It is only when moving to work I keep the phone in my front pocket and put it on my desk as soon as I get in the office or at ho
-
Two monitors on Pavilion 500-214
What two monitors are no longer compatible with this specific desktop computer? Its configuration is out-of-the-box (no change internally have been made). I have currently 2 monitors VGA Acer put in place, but the second monitor goes black every few
-
My computer will not update successfully
My computer does not correctly update. He tries to update the 3 steps, but after 45 minutes, the following message appears on my screen: "updates were not correctly configured. Restoration of the changes. Do not turn off your computer. "My compute
-
Hi all No, not so much a question, but I thought I'd post here because it can help others. I used Corel Draw X 3 yesterday (12/12/12) to make a simple business card text only. Today - the file open and something is there, but the text is invisible. F