Launch a query from a function
Is it possible to launch a function that execute a query on a table and retun a single date value?
I mean without using data-model.
I'm developing in Jsp with Jdev 10G
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Class1
public Class1()
* @param args
public static void main(String[] args)
Class1 class1 = new Class1();
try
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@localhost:1521:orcl");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery ("SELECT sysdate FROM dual");
while (rset.next())
{System.out.println (rset.getString(1));}
catch (SQLException e)
System.out.println(e);
}
Similar Messages
-
PC session hangs when launch a query from Oracle 9i client to 10g database
I have a pc with Oracle 9.2.0.1.0 client installed. The database server level is 10.1.0.5.
When I launch a query from a client session the pc sesssion locks up and doesn't return any results. When I launch the same query from the database server , or from other pcs with Oracle client 10 installed , I get results almost immediately from the query.
The pc in question is running Windows XP Service pack 2. Other queries run fine from the pc.
Are there are any known issues with Oracle 9 clients querying an Oracle 10 database ?Thank you for your reply. No, I must admit I didn't think of looking at the wait events. I will look at this as soon as I get a chance.
Thanks again for your suggestion. -
Mantaining closed the query structure when launching a query from "query mg
Hi,
Is it possible to maintain closed the query structure window when launching a query from the "Query manager" menu?
As say, if I want to see the query syntax, I must click on the "Display query structure" symbol.
Now the query results windows, always starts with the "query structure" opened.
Thanks
AntonioHi Antoni,
Only system built-in queries allow that. We could not control this button to hide query by default. You may post it as a DRQ on this forum:
/community [original link is broken]
Thanks,
Gordon -
Get ID from database, launching a query from code and set NOCOUNT clause
Hello,
I need to extract some id from some table in mydatabase. I launching query from code.
I would like to know if it is correct what I do
SET NOCOUNT ON
SELECT ID FROM tblID
SET NOCOUNT OFF
it is right to set nocount on at the beginning and if you need to reset it in the end.
Many thanks
www.Photoballot.netWhen SET NOCOUNT is ON, the count is not returned. When SET NOCOUNT is OFF, the count is returned.
SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, or for procedures that contain Transact-SQL loops,
setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.
It won't have any major impact in your case however like they say its good to have it.
To read more about see -
http://msdn.microsoft.com/en-us/library/ms189837.aspx
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful". -
How to Launch a Query from the Easy Access Menu
Hello Experts,
Once I have created, saved and tested my query how can I set it up so that my users can either type in a transaction at the Easy Access Menu or select my query from the Easy Access Menu and launch the query input screen that displays fields for:
Reporting Period
Selection Criteria - Personnel Number, Employment Status, Personnel Area etc.
Program Selections - company code
Output Format
Thanks.
Regards,
JeanetteHello Jeanette
You may refer to following thread
Assign transaction code to SAP Query (created via SQ01)
Hope this helps
Best Regards
Reddy -
BULK COLLECT in select query inside a function
Hi All,
My query is :
SELECT col1,col2,col3 FROM table_a; --( consider this is a long running query with lot of joins)
Need to know how can i get the output of the above query from a function using BULK COLLECT.
and i tried this:
CREATE OR REPLACE TYPE tab_a_row
AS OBJECT (
col1 number(20),
col2 number(20),
col2 number(20)) ;
create or replace type tab_a_nt as table of tab_a_row;
create or replace function get_table_a
return sys_refcursor
is
tab_a_recs tab_a_nt;
rv sys_refcursor;
begin
SELECT tab_a_row(col1,col2,col3) BULK COLLECT INTO tab_a_recs FROM table_a;
open rv for select * from table(tab_a_recs);
return rv;
end;
Function created successfully. and i exec this from sql plus using
SQL> var rc refcursor;
SQL> exec :rc := get_table_a;
BEGIN :rc := get_table_a; END;
ERROR at line 1:
ORA-22905: cannot access rows from a non-nested table item
ORA-06512: at "GET_TABLE_A", line 12
ORA-06512: at line 1
Kindly share your ideas on how to use bulk collect and get set of outputs from a function.
Edited by: 887268 on Apr 18, 2013 3:10 AM>
If i use refcursor , then the JAVA code needs to be changed accordinglyto get the refcursor output.
>
Well, of course. Java has to know what the sql projection is. How else will it know how many columns there are and their datatypes.
But that is true no matter what method you use.
>
But if i use a PLSQL COLLECTION TYPE (nested tables ) , then i can get output as ,
select * from table(function_name(input1,input2));
>
No - using the 'table' function mean you are calling a PIPELINED function.
This is a sample of a PIPELINED procedure.
-- type to match emp record
create or replace type emp_scalar_type as object
(EMPNO NUMBER(4) ,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7, 2),
COMM NUMBER(7, 2),
DEPTNO NUMBER(2)
-- table of emp records
create or replace type emp_table_type as table of emp_scalar_type
-- pipelined function
create or replace function get_emp( p_deptno in number )
return emp_table_type
PIPELINED
as
TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
emp_cv EmpCurTyp;
l_rec emp%rowtype;
begin
open emp_cv for select * from emp where deptno = p_deptno;
loop
fetch emp_cv into l_rec;
exit when (emp_cv%notfound);
pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
end loop;
return;
end;
select * from table(get_emp(20))Or your function could return a collection like the example from this thread this morning.
Example of Collection as datatype of a function’s return value
CREATE OR REPLACE TYPE enamelist as VARRAY(20) of VARCHAR2(20)
/* Formatted on 4/18/2013 4:06:47 PM (QP5 v5.126.903.23003) */
CREATE OR REPLACE FUNCTION ename_fn
RETURN enamelist
AS
v_cursor_main enamelist := enamelist ();
BEGIN
SELECT ename
BULK COLLECT
INTO v_cursor_main
FROM emp;
RETURN v_cursor_main;
EXCEPTION
WHEN OTHERS
THEN
RETURN v_cursor_main;
END;
select * from table(ename_fn()) from dual;
COLUMN_VALUE
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER -
Return value from database function taking a lot more time than the query
Hi guys,
I have a Query that does a call to a database function. The function takes in a few parameters and returns a Date. Now, the query within the function takes barely .05 seconds. However, doing a select get_join_dates from dual is taking almost 6 seconds for each call.
Here is the Query:
select s.student_id, s.student_name, s.organization_code
from student s
where s.student_id = :p_student_id
and s.student_enrollment_date = get_join_dates( :p_year,
:p_month,
:p_student_id,
s.organization_code );And here is the database function. The select inside this function barely takes 0.05 seconds per call. This function gets called 3 times in my case as there are 3 records in the org_body table for this student.
create or replace function
get_join_dates( p_yyyy in org_body.fiscal_yyyy%type,
p_month in org_body.fiscal_mm%type,
p_student_id in student.student_id%type,
p_organization_code in org_body.organization_code%type) return date as
t_enrollment_date date;
cursor cur_latest_enrollment_date is
select max(enrollment_date)
from org_body
where fiscal_yyyy = p_yyyy
and fiscal_mm = p_month
and student_id = p_student_id
and organization_code = p_organization_code;
BEGIN
open cur_latest_enrollment_date ;
fetch cur_latest_enrollment_date into t_enrollment_date;
close cur_latest_enrollment_date ;
return t_enrollment_date;
exception
when others then
null;
end;owever, when I run the following statement below, it takes close to 6 seconds to retrieve a record. In turn, my Query is becoming really slow and taking almost 35 seconds. Imagine that with more records.
select get_join_dates( 2010, '01', '2167543', 'PSYCH01' ) from dual;If I run my query with this condition below, it takes 0.5 seconds.
select s.student_id, s.student_name, s.organization_code
from student s
where s.student_id = :p_student_id
and s.student_enrollment_date = '01-JAN-10'Any ideas would be greatly appreciated.Any reason why you are doing this with the stored function?
You could just do this with SQL. Embed the query in the function as a subquery in your initial query from STUDENT.
select s.student_id, s.student_name, s.organization_code
from student s
where s.student_id = :p_student_id
and s.student_enrollment_date =
(select max(enrollment_date)
from org_body
where fiscal_yyyy = :p_year
and fiscal_mm = :p_month
and student_id = s.student_id
and organization_code = s.organization_code);Why your function is not performing: I cannot say that with the information you have provided.
Maybe sqltrace a call and see what the reason is. -
A query regarding synchronised functions, using shared object
Hi all.
I have this little query, regarding the functions that are synchronised, based on accessing the lock to the object, which is being used for synchronizing.
Ok, I will clear myself with the following example :
class First
int a;
static int b;
public void func_one()
synchronized((Integer) a)
{ // function logic
} // End of func_one
public void func_two()
synchronized((Integer) b)
{ / function logic
} // End of func_two
public static void func_three()
synchronized((Integer) a)
{ // function logic
} // End of func_three, WHICH IS ACTUALLY NOT ALLOWED,
// just written here for completeness.
public static void func_four()
synchronized((Integer) b)
{ / function logic
} // End of func_four
First obj1 = new First();
First obj2 = new First();
Note that the four functions are different on the following criteria :
a) Whether the function is static or non-static.
b) Whether the object on which synchronization is based is a static, or a non-static member of the class.
Now, first my-thoughts; kindly correct me if I am wrong :
a) In case 1, we have a non-static function, synchronized on a non-static object. Thus, effectively, there is no-synchronisation, since in case obj1 and obj2 happen to call the func_one at the same time, obj1 will obtain lock for obj1.a; and obj2 will obtain lock to obj2.a; and both can go inside the supposed-to-be-synchronized-function-but-actually-is-not merrily.
Kindly correct me I am wrong anywhere in the above.
b) In case 2, we have a non-static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a. However, since obj1.a and obj2.a are the same, thus we will indeed obtain sychronisation.
Kindly correct me I am wrong anywhere in the above.
c) In case 3, we have a static function , synchronized on a non-static object. However, Java does not allow functions of this type, so we may safely move forward.
d) In case 4, we have a static function, synchronized on a static object.
Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a. However, since obj1.a and obj2.a are the same, thus we will indeed obtain sychronisation. But we are only partly done for this case.
First, Kindly correct me I am wrong anywhere in the above.
Now, I have a query : what happens if the call is made in a classically static manner, i.e. using the statement "First.func_four;".
Another query : so far we have been assuming that the only objects contending for the synchronized function are obj1, and obj2, in a single thread. Now, consider this, suppose we have the same reference obj1, in two threads, and the call "obj1.func_four;" happens to occur at the same time from each of these threads. Thus, we have obj1 rying to obtain lock for obj1.a; and again obj1 trying to obtain lock for obj1.a, which are the same locks. So, if obj1.a of the first thread obtains the lock, then it will enter the function no-doubt, but the call from the second thread will also succeed. Thus, effectively, our synchronisation is broken.
Or am I being dumb ?
Looking forward to replies..
Ashutosha) In case 1, we have a non-static function, synchronized on a non-static object. Thus, effectively, there is no-synchronisationThere is no synchronization between distinct First objects, but that's what you specified. Apart from the coding bug noted below, there would be synchronization between different threads using the same instance of First.
b) In case 2, we have a non-static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a.obj1/2 don't call methods or try to obtain locks. The two different threads do that. And you mean First.b, not obj1.b and obj2.b, but see also below.
d) In case 4, we have a static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a.Again, obj1/2 don't call methods or try to obtain locks. The two different threads do that. And again, you mean First.b. obj1.b and obj2.b are the same as First.b. Does that make it clearer?
Now, I have a query : what happens if the call is made in a classically static manner, i.e. using the statement "First.func_four;".That's what happens in any case whether you write obj1.func_four(), obj2.func)four(), or First.func_four(). All these are identical when func_four(0 is static.
Now, consider this, suppose we have the same reference obj1, in two threads, and the call "obj1.func_four;" happens to occur at the same time from each of these threads. Thus, we have obj1 rying to obtain lock for obj1.aNo we don't, we have a thread trying to obtain the lock on First.b.
and again obj1 trying to obtain lock for obj1.aYou mean obj2 and First.b, but obj2 doesn't obtain the lock, the thread does.
which are the same locks. So, if obj1.a of the first thread obtains the lock, then it will enter the function no-doubt, but the call from the second thread will also succeed.Of course it won't. Your reasoning here makes zero sense..Once First.b is locked it is locked. End of story.
Thus, effectively, our synchronisation is broken.No it isn't. The second thread will wait on the same First.b object that the first thread has locked.
However in any case you have a much bigger problem here. You're autoboxing your local 'int' variable to a possibly brand-new Integer object every call, so there may be no synchronization at all.
You need:
Object a = new Object();
static Object b = new Object(); -
Error while tesing a Datasource created from Java function
Hi ,
I am trying to create a datasource from java function.After build/deploy i am getting the following error . The java class i am using from the EvalGuide Sample. Anybody had similar issues ?
regards
GK
weblogic.xml.query.exceptions.XQueryStaticException: {lib:TestLayer/xfl/library1}protectSSN:1, line 4, column 1: {err}XQ0017: "{lib:TestLayer/xfl/library1}protectSSN": unknown function (or number of arguments (1) is wrong)
at com.bea.ld.server.XQuery.createInvocation(XQuery.java:228)
i am using WLS8.1 sp 6 ,ALDSP 2.5I am testing from Test View.
I tried build-->deploy-->redeploy several times.
Pls find the complete trace below
eblogic.xml.query.exceptions.XQueryStaticException: {lib:TestLayer/xfl/library}protectSSN:1, line 4, column 1: {err}XQ0017: "{lib:TestLayer/xfl/library}protectSSN": unknown function (or number of arguments (1) is wrong)
at com.bea.ld.server.XQuery.createInvocation(XQuery.java:228)
at com.bea.ld.EJBRequestHandler.invokeQuery(EJBRequestHandler.java:559)
at com.bea.ld.EJBRequestHandler.invokeFunction(EJBRequestHandler.java:775)
at com.bea.ld.EJBRequestHandler.executeFunction(EJBRequestHandler.java:339)
at com.bea.ld.ServerBean.executeFunction(ServerBean.java:95)
at com.bea.ld.Server_ydm4ie_EOImpl.executeFunction(Server_ydm4ie_EOImpl.java:954)
at com.bea.ld.Server_ydm4ie_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:491)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:120)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:434)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:429)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183) -
Error - opening a web query from my favorite or roles
I am trying to open a query saved as web query from my favorite folder or user menu. I got error when processing the request. Below is the detailed error.
Error when processing your request
What has happened?
The URL http://p2pr3.ittind.com:8000/sap/bw/BEx was not called due to an error.
Note
The following error text was processed in the system DVR : You can only work in client 010
The error occurred on the application server P2PR3_DVR_00 and in the work process 0 .
The termination type was: ABORT_MESSAGE_STATE
The ABAP call stack was:
Function: RS_MANDT_CHECK of program SAPLRSMANDT
Form: CLIENT_CHECK of program SAPLRSDG_IOBJ_DB_READ
Function: RSD_IOBJ_GET_A_THEN_M of program SAPLRSDG_IOBJ_DB_READ
Function: RSZ_X_COMPONENT_EXIST of program SAPLRZX0
Form: GET_AUTHORIZATION of program CL_RSRD_UTILITIES_BW_OBJECTS==CP
Form: SET_ITEM of program CL_RSRD_WWW_ITEM_BROADCASTER==CP
Form: INIT of program CL_RSR_WWW_ITEM===============CP
Form: CREATE of program CL_RSR_WWW_ITEM===============CP
Form: SET_ITEM of program CL_RSR_WWW_PAGE===============CP
Form: SET_TEMPLATE_ITEMS of program CL_RSR_WWW_ITEM_TEMPLATE======CP
What can I do?
If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system DVR in transaction ST22.
If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server P2PR3_DVR_00 in transaction SM21.
If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server P2PR3_DVR_00 . In some situations, you may also need to analyze the trace files of other work processes.
If you do not yet have a user ID, contact your system administrator.
Error code: ICF-IE-http -c: 035 -u: NKRISHNA -l: E -s: DVR -i: P2PR3_DVR_00 -w: 0 -d: 20081022 -t: 120849 -v: ABORT_MESSAGE_STATE -e: You can only work in client 010
Any steps to solve this issue will be appreciated and awarded. ThanksHi Experts,
We are also having the same issue. We are in BI 7 SP 15.
Is there any way to find the relation between the Bookmark ID and Query name? The favorite link is not working and getting the above error message. We are also not able to identify the query related to this favorite / bookmark link. Is there any table to identify for query and Bookmark?
Can you experts advise urgently? Advance Thanks.
Linda. -
I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
Here is my dilemma:
I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
Thank you,
Tony Miller
UTMB/EHN
Title changed, maybe SOMEONE has an idea on this??
Message was edited by:
Tony MillerHi,
1/ first check you are passing the bind variables and
appropriate values in the call to your report - if
the query returns no data then you get an empty page
So if your query takes :P10_USERNAME variable then
pass it to the report in the URL
f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=YOUR_REP_QUERY_N
AME:::P10_USERNAME:MYUSER
2/ try to use the Default layout first to check your
report query really returns the data when called
3/ if you defined a header in your rtf template check
there is no & (ampersand) - if using & in the header
and preview the template from word it displays data
OK, but if you use this template in the report query
it fails to render the data (bug in Apex-> Bi
Publisher integration maybe?)
4/ If using the table in the rtf template check its
width does not overflow the page margins - there is a
problem with pdf export
5/ check
/oc4j/j2ee/home/application-deployments/xmlpserver/app
lication.log forthe information on BI Publisher runs
RadoIssue was in the APEX page having issues.. I recoded a new page and am able to generate BI Publisher based PDF files..
Thank you,
Tony Miller
UTMB/EHN -
SQL query (pl/sql function body returning query) performance issue
I create my report in building my sql instruction with ( SQL Query pl/sql function body returning sql query );
My report take more than 20 seconds however if i did a cut and paste with the sql code in TOAD the same sql take 1 second.
To try to discover the source of the problem; i take the sql generated by the function and i create another report ( sql query ) this new report take 2 seconds.
My query is very big 25,000 characters with database link.
What is the difference between SQL-quey and sql-query(pl/sql function body returning sql query)
Thanks
MarcMarc,
Firstly...don't compare the timings from Toad, since often Toad only fetches the first few records for you (i.e. it pages them).
Secondly....the database link could be a factor here, but without seeing your query it's too hard to say.
Can you post the query somewhere (on a webserver say)? -
Query not considering function based index in oracle 11g
I have a query which used Function Based Index when run in oracle 9i but when I run the same query
without any changes, it does not consider index. Below is the query:
SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
patient_role.emergency_contact_name,
patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
patient_role.emergency_contact_relation_id,
patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
patient_role.CREATED_TIMESTAMP,
patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
patient_role.UPDATED_TIMESTAMP_TZ,
patient_role.discontinued_date
FROM encounter, patient_role
WHERE patient_role.patient_role_key = encounter.patient_role_key
AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
:SYS_B_2))
AND patient_role.discontinued_date IS null
AND encounter.discontinued_date IS null ;
Index definition:
CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
'0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT)
TABLESPACE "user1"
Database : Oracle 11g (11.2.0.3)
O/S : Linux 64 bit (the query does not consider index even on windows os)
Any suggestions?
-Onkar
Edited by: onkar.nath on Jul 2, 2012 3:32 PMOnkar,
I don't appreciate you posting this question in several forums at the same time.
If I would know you also posted this on Asktom, I wouldn't even have bothered.
As to your 'issue':
First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
Right now you are already putting workaround on workaround on workaround on workaround.
Issue is the application: it is terminal., and you either need to kill it, or to replace it.
Sybrand Bakker
Senior Oracle DBA -
SQL Query (pl/sql function body returning Sql query)
Hi All,
I have created a region of "SQL Query (pl/sql function body returning Sql query)" type and it is working fine , but when I am migrating(export /import) this application from development to systest environment ,
It gives error for this region :
Error ERR-1101 Unable to process function body returning query.
OK
ORA-06550: line 1, column 52: PLS-00306: wrong number or types of arguments in call to 'FU_TRADE_REPORT_QUERY' ORA-06550: line 1, column 45: PL/SQL: Statement ignored
Any pointer ...why this is happening.
Thanks
DikshitIf your function is a stored function that is called from within APEX (function body not coded into the app itself), have you made sure that the function has been created and compiles ok prior to installing your apex app.
If there are some dependency issues between other PL/SQL units or database objects that are causing your function not to be compiled, you apex install will fail as you are trying to reference an uncompelled bit of pl/sql.
Let me know how you get on
Regards
Duncan -
SQL Query(PL/SQL Function Returning SQL Query)
I am trying to write a dynamic report using SQL Query(PL/SQL Function Returning SQL Query).
I can get the report to run but I need to concatinate some columns into one, seperated by a comma or a dash.
I have tried select *****||','||***** alias
also select *****||'-'||***** alias
but I always get an error.
Is there a way of doing this please
GusThis is my full query
declare
v_query varchar2(4000);
begin
if :P63_TRAN_INFO = 2 THEN
v_query := 'select
A.FILENR,
A.EXERCISENAME,
A.STARTDATE,
A.ENDDATE,
A.UNIT,
A.ACCADDRESSES, B.ADDRESS, B.ADDRESS_1, B.POST_CODE, B.TOWN,
A.EXERCISEAREAS,
A.TOTALVEHICLES,
A.TOTALTROOPS+A.RNTOTALTROOPS+A.RAFTOTALTROOPS TOTALTROOPS,
A.CAR, A.MINIBUS, A.HGV,
A.NAMERANK, A.ADDRESS, A.ADDRESSI, A.ADDRESSII, A.POSTCODE,
A.TRANSIT,
A.INFOONLY
from BFLOG_AT A, BFLOG_ACCADDRESS B
WHERE A.ACCADDRESSES = B.NAME
AND A.STARTDATE >= :P63_START_DATE
AND A.ENDDATE <= :P63_END_DATE
AND A.AUTHORISED = 1
AND A.INFOONLY = 1' ;
END IF;
RETURN v_query;
END;
This query runs ok, but if I try changing it to the code below with fields concatinated, then it fails
declare
v_query varchar2(4000);
begin
if :P63_TRAN_INFO = 2 THEN
v_query := 'select
A.FILENR,
A.EXERCISENAME,
A.STARTDATE,
A.ENDDATE,
A.UNIT,
A.ACCADDRESSES||','||B.ADDRESS||','||B.ADDRESS_1||','||B.POST_CODE||','||B.TOWN ADDRESS,
A.EXERCISEAREAS,
A.TOTALVEHICLES,
A.TOTALTROOPS+A.RNTOTALTROOPS+A.RAFTOTALTROOPS TOTALTROOPS,
A.CAR, A.MINIBUS, A.HGV,
A.NAMERANK, A.ADDRESS, A.ADDRESSI, A.ADDRESSII, A.POSTCODE,
A.TRANSIT,
A.INFOONLY
from BFLOG_AT A, BFLOG_ACCADDRESS B
WHERE A.ACCADDRESSES = B.NAME
AND A.STARTDATE >= :P63_START_DATE
AND A.ENDDATE <= :P63_END_DATE
--AND (A.EXERCISEAREAS LIKE "GAP, OA, OAL")
--OR (A.EXERCISEAREAS LIKE "Harz")
AND A.AUTHORISED = 1
AND A.INFOONLY = 1' ;
END IF;
RETURN v_query;
END;
Cheers
Gus
Maybe you are looking for
-
I can't believe iCal List printing is still unsorted - HOW HARD CAN THIS BE TO FIX APPLE ?!!!!?
-
I bought Samsung 52" LCD TV about 2 years ago in Best Buy. The very last time I watched TV was 5 days ago. Then, 2 days later, when I was going to watch TV again, I found the TV wouldn't response from the remote control. I changed the battery on the
-
Transfering music from a Windows formatted ipod to a Mac - is it possible?
I have a bit of an interesting problem. All my life I've used Macs, occasionally a PC, but I definitely prefer Macs. Anyhow, I currently have a PC, temporarially, I will be getting an iBook late Spring this year, and I have two iPods, a 4G formatted
-
Issue Regarding SAP HR Implimentation
Hi, Can anybody provide me the list of SAP HR implemented compnies of Delhi/NCR in Last 2 years. Thanks & Regards, Geeta Chaudhary. Have you Got the answer for this question in your earlier thread
-
UIScrollView can do all the scaling for us. But it scales both in horizontal and vertical direction.Is there any way to scale in horizontal only?