Commit to SQL statement
Hello N. Gasparotto,
I have written and tried the code.
I got the desired result.
Actually I have a form. That form has "slope" as label with the list of values:
0-2%
2-6%
10-15%
6-8% and so on.
the code for that form is written in jsp which includes sql statements.
whenever i make changes to the database through jsp, i generally commit the changes in the database so that i can see the changes in the form.
After execution of your code, i got the desired result.at the sql prompt, i typed commit. it displayed commit complete. The JSP code contains the sql statement:
"select item from code_slope where code_slope<>'9999' order by 2 asc;"
So after execution of this jsp, I would like to see the list of values in the following order:
Slope:
0-2%
2-6%
6-8%
10-15%.
But I couldn't find the change in the form.
Could you guide me what i need to do next when i execute format_numeric function and the other code so that i could see the change in the form?
Waiting for reply!
Prathima.
Waiting for reply!
Hello sir,
I am unable to express my problem. Let me explain what my problem is with an example that best suits my current problem.
For example, I have a jsp page with field "Level".That jsp page contains code(for example, select level from tname order by 2 asc) for that field "Level".If we assume that the field Level has a list box with values "One, Two and so on". Now on the database side I would like to add new value into that Level field "Three".After inserting new value into that field, I commit the change on the database side(sql>commit). When I refresh the jsp page, I could see the new value in the existing list box values.
Coming to the current problem, when I execute format_numeric and sort function, i could get the desired output. But when i refresh that particular jsp, i could not find the values in the sorted order.Could you please let me know what i need to do when i execute the format_numeric function + sort statement.
Eagerly Waiting for reply!
Prathima
Similar Messages
-
Max no. of Update SQL statements before a commit
In Oracle 10.2 what is maximum number of UPDATE statements that I can execute before issuing commit.
If maximum is there either by no. of SQL statements or size in KB, what will happen if I go above this number.
Thanks in advance for your response.
Edited by: vbforums on Feb 21, 2011 3:50 PMsb92075 wrote:
I executed 5000+ update statements from Java in one shotI am curious.
Does each UPDATE change only a single row?
I'll ask a different way.
Can a single UPDATE statement change all desired rows?yes
SQL> conn scott/tiger
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
EMP
DEPT
SQL> create table mytest(cola varchar2(1));
Table created.
SQL> insert into mytest values ('A');
1 row created.
SQL> insert into mytest values ('A');
1 row created.
SQL> insert into mytest values ('A');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from mytest;
C
A
A
A
SQL> update mytest set cola='B' where cola='A';
3 rows updated.
SQL> commit;
Commit complete.
SQL> select i * from mytest;
C
B
B
B
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@vmlnx01 dbs]$ exit
logout -
Can i use commit in between pl sql statements
Hi,
I have written program unit , in that I used insert statements and after that I used commit command.
But in runtime it's getting oracle error unable to insert . because I used some non database items and database items
so that it's coming error.
But my question is , Can i use commit after executing some statements in program unit procedure.
Thanks in advance.FORMS_DDL restrictions
The statement you pass to FORMS_DDL may not contain bind variable references in the string, but the
values of bind variables can be concatenated into the string before passing the result to FORMS_DDL.
For example, this statement is not valid:
Forms_DDL ('Begin Update_Employee (:emp.empno); End;');
However, this statement is valid, and would have the desired effect:
Forms_DDL ('Begin Update_Employee ('||TO_CHAR(:emp.empno)
||');End;');
However, you could also call a stored procedure directly, using Oracle8's shared SQL area over
multiple executions with different values for emp.empno:
Update_Employee (:emp.empno);
SQL statements and PL/SQL blocks executed using FORMS_DDL cannot return results to Form
Builder directly.
In addition, some DDL operations cannot be performed using FORMS_DDL, such as dropping a table
or database link, if Form Builder is holding a cursor open against the object being operated upon.
Sarah -
SQLEXEC not able to filter extract on sql statement or function call.
hi all,
i'm trying to do some basic extract filtering using a stored function and am not having much success.
i started off using a procedure call but have been unsuccessful getting that working, i've simplified
it to use a sql statement calling a function for a value to filter on, but cannot even get that to work.
i've read through the documentation and i cannot figure out what is going wrong.
any help would be much appreciated.
thx,
daniel
function code is very simple, just trying to get something working.
FUNCTION f_lookup_offer_id(v_offer_id IN offer.offer_id%TYPE)
RETURN company.name%TYPE IS
lv_company_name company.name%TYPE;
BEGIN
SELECT c.name
INTO lv_company_name
FROM orders a, offer b, company c
WHERE a.offer_id = b.offer_id
AND b.company_id = c.company_id
AND a.order_id = v_order_id;
RETURN lv_company_name;
END f_lookup_offer_id ;
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Solaris, sparc, 64bit (optimized), Oracle 10 on Jul 28 2010 13:26:39
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXTRACT EATUOP1
INCLUDE ./dirprm/GGS_LOGIN.inc
EXTTRAIL ./dirdat/up
DISCARDFILE ./dirout/eatuop1.dsc, append , MEGABYTES 50
DISCARDROLLOVER ON SUNDAY AT 06:00
-- Database and DDL Options
-- Added to avoid errors when setting unused columns
DBOPTIONS ALLOWUNUSEDCOLUMN
-- Get full row for deletes
NOCOMPRESSDELETES
-- Get updates before
GETUPDATEBEFORES
-- If commit SCN that is not greater than the highest SCN already processed error
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 15000 IOLATENCY 6000
-- Retains original timestamp. Currently using GMT
NOTCPSOURCETIMER
--TABLE DEFS
TABLE master.OFFER,
SQLEXEC ( ID ck_offer,
QUERY " select master.f_lookup_offer_id(:off_id) is_company from dual ",
PARAMS (off_id = offer_id),
BEFOREFILTER),
FILTER (@GETVAL (ck_offer.is_company = "Google, Inc."));
does not give any errors, but also does not capture any data, it's filtering everything out and trail files are empty, minus a header.
thoughts or help?
2012-04-04 22:17:36 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, eatuop1.prm: EXTRACT EATUOP1 started.
2012-04-04 22:17:36 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery initialization completed for target file ./dirdat/up000022, at RBA 978.
2012-04-04 22:17:36 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Output file ./dirdat/up is using format RELEASE 10.4/11.1.
2012-04-04 22:17:36 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Rolling over remote file ./dirdat/up000022.
2012-04-04 22:17:36 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for target file ./dirdat/up000023, at RBA 978.
2012-04-04 22:17:36 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for all targets.
2012-04-04 22:17:36 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Position of first record processed Sequence 13469, RBA 21894160, SCN 1789.722275534, Apr 4, 2012 10:12:40 PM.
-rw-rw-rw- 1 svc_ggs 502 978 Apr 4 22:17 up000023got it working, this seems to be about as simple as i could formulate it. thanks for pointing me in the right direction.
TABLE GGS_TEST_EXT, &
SQLEXEC ( ID co_count, &
QUERY " select f_lookup_company_name(:P1) x from dual ", &
PARAMS ( P1 = company_id), BEFOREFILTER), &
FILTER ( @GETVAL (co_count.x = 0) );
then i have a function that returns 1 or 0, depending on the company id passed in.
thx,
daniel -
Sql statement in a table not accepting variable
I have the following problem on 10.1.0.3.0 with varialbe in an execute immediate statement
here is the code that I am using
declare
remote_data_link varchar2(25) := 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA VARCHAR2(40) := 'UDE_OLTP';
l_last_process_date date := to_date(to_char(sysdate,'mm-dd-yyyy hh:mi:ss'),'mm-dd-yyyy hh:mi:ss') - 1;
stmt varchar2(4000) := 'MERGE into applicant_adverseaction_info theTarget USING (select * from '||FROM_SCHEMA||'.applicant_adverseaction_info@'||remote_data_link||' where last_activity > :l_last_process_date ) theSource ON(theTarget.applicant_id = theSource.applicant_id) WHEN MATCHED THEN UPDATE SET theTarget.cb_used = theSource.cb_used, theTarget.cb_address = theSource.cb_address, theTarget.scoredmodel_id = theSource.scoredmodel_id, theTarget.last_activity = theSource.last_activity WHEN NOT MATCHED THEN INSERT(CB_USED, CB_ADDRESS, SCOREDMODEL_ID, APPLICANT_ID, LAST_ACTIVITY) values(theSource.cb_used, theSource.cb_address, theSource.scoredmodel_id, theSource.applicant_id, theSource.last_activity)';
stmt2 varchar2(4000) := 'MERGE into edm_application theTarget USING (select * from '||from_schema||'.edm_application@'||remote_data_link||' where last_activity > :l_last_process_date) theSource ON (theTarget.edm_appl_id = theSource.edm_appl_id) WHEN MATCHED THEN UPDATE SET theTarget.APP_REF_KEY = theSource.APP_REF_KEY, theTarget.IMPORT_REF_KEY = theSource.IMPORT_REF_KEY, theTarget.LAST_ACTIVITY = theSource.LAST_ACTIVITY WHEN NOT MATCHED THEN INSERT (EDM_APPL_ID, APP_REF_KEY, IMPORT_REF_KEY, LAST_ACTIVITY) values(theSource.EDM_APPL_ID, theSource.APP_REF_KEY, theSource.IMPORT_REF_KEY, theSource.LAST_ACTIVITY)';
v_error varchar2(4000);
T_MERGE VARCHAR2(4000);
stmt3 varchar2(4000);
BEGIN
select merge_sql
INTO T_MERGE
from transfertables
where table_name= 'edm_application';
remote_data_link:= 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA := 'UDE_OLTP';
--DBMS_OUTPUT.PUT_LINE(SUBSTR(stmt2,1,200));
--STMT2 := T_MERGE;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
EXECUTE IMMEDIATE stmt2 using l_last_process_date;
--execute immediate stmt3 ;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
dbms_output.put_line(substr(stmt2,1,200));
commit;
EXCEPTION
WHEN OTHERS THEN
V_ERROR := SQLCODE||' '||SQLERRM;
v_ERROR := V_ERROR ||' '||SUBSTR(stmt2,1,200);
DBMS_OUTPUT.PUT_LINE(V_ERROR);
--dbms_output.put_line(substr(stmt2,1,200));
END;
This works perfectly
but if I change it to get the same statement in a db table
declare
remote_data_link varchar2(25) := 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA VARCHAR2(40) := 'UDE_OLTP';
l_last_process_date date := to_date(to_char(sysdate,'mm-dd-yyyy hh:mi:ss'),'mm-dd-yyyy hh:mi:ss') - 1;
stmt varchar2(4000) := 'MERGE into applicant_adverseaction_info theTarget USING (select * from '||FROM_SCHEMA||'.applicant_adverseaction_info@'||remote_data_link||' where last_activity > :l_last_process_date ) theSource ON(theTarget.applicant_id = theSource.applicant_id) WHEN MATCHED THEN UPDATE SET theTarget.cb_used = theSource.cb_used, theTarget.cb_address = theSource.cb_address, theTarget.scoredmodel_id = theSource.scoredmodel_id, theTarget.last_activity = theSource.last_activity WHEN NOT MATCHED THEN INSERT(CB_USED, CB_ADDRESS, SCOREDMODEL_ID, APPLICANT_ID, LAST_ACTIVITY) values(theSource.cb_used, theSource.cb_address, theSource.scoredmodel_id, theSource.applicant_id, theSource.last_activity)';
stmt2 varchar2(4000) := 'MERGE into edm_application theTarget USING (select * from '||from_schema||'.edm_application@'||remote_data_link||' where last_activity > :l_last_process_date) theSource ON (theTarget.edm_appl_id = theSource.edm_appl_id) WHEN MATCHED THEN UPDATE SET theTarget.APP_REF_KEY = theSource.APP_REF_KEY, theTarget.IMPORT_REF_KEY = theSource.IMPORT_REF_KEY, theTarget.LAST_ACTIVITY = theSource.LAST_ACTIVITY WHEN NOT MATCHED THEN INSERT (EDM_APPL_ID, APP_REF_KEY, IMPORT_REF_KEY, LAST_ACTIVITY) values(theSource.EDM_APPL_ID, theSource.APP_REF_KEY, theSource.IMPORT_REF_KEY, theSource.LAST_ACTIVITY)';
v_error varchar2(4000);
T_MERGE VARCHAR2(4000);
stmt3 varchar2(4000);
BEGIN
select merge_sql
INTO T_MERGE
from transfertables
where table_name= 'edm_application';
remote_data_link:= 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA := 'UDE_OLTP';
--DBMS_OUTPUT.PUT_LINE(SUBSTR(stmt2,1,200));
STMT2 := T_MERGE;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
EXECUTE IMMEDIATE stmt2 using l_last_process_date;
--execute immediate stmt3 ;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
dbms_output.put_line(substr(stmt2,1,200));
commit;
EXCEPTION
WHEN OTHERS THEN
V_ERROR := SQLCODE||' '||SQLERRM;
v_ERROR := V_ERROR ||' '||SUBSTR(stmt2,1,200);
DBMS_OUTPUT.PUT_LINE(V_ERROR);
--dbms_output.put_line(substr(stmt2,1,200));
END;
I get ora-00900 invalid sql statement
can somebody explain why this happens
ThanksI agree with jan and anthony. Your post is too long and ill-formatted. However here's my understanding of your problem (with examples though slightly different ones).
1- I have a function that returns number of records in a any given table.
1 CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 BEGIN
5 EXECUTE IMMEDIATE('SELECT count(*) FROM '||p_table) INTO v_cnt;
6 RETURN v_cnt;
7* END;
SQL> /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
GET_COUNT('EMP')
14
2- I decide to move the statement to a database table and recreate my function.
SQL> CREATE TABLE test
2 (stmt varchar2(2000))
3 /
Table created.
SQL> INSERT INTO test
2 VALUES('SELECT count(*) FROM p_table');
1 row created.
SQL> CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 v_stmt varchar2(4000);
5 BEGIN
6 SELECT stmt INTO v_stmt
7 FROM test;
8 EXECUTE IMMEDIATE(v_stmt) INTO v_cnt;
9 RETURN v_cnt;
10 END;
11 /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
SELECT get_count('emp')
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SCOTT.GET_COUNT", line 8
ORA-06512: at line 1
--p_table in the column is a string and has nothing to do with p_table parameter in the function. And since there's no p_table table in my schema function returns error on execution. I suppose this is what you mean by "sql statement in a table not accepting variable"
3- I rectify the problem by recreating the function.
1 CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 v_stmt varchar2(4000);
5 BEGIN
6 SELECT replace(stmt,'p_table',p_table) INTO v_stmt
7 FROM test;
8 EXECUTE IMMEDIATE(v_stmt) INTO v_cnt;
9 RETURN v_cnt;
10* END;
SQL> /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
GET_COUNT('EMP')
14
Hope this gives you some idea.-----------------------
Anwar -
Adding a field to an sql statement in Oracle Reports error ORA-00933
We have been requested to add a field that already exists in the table referred to by the sql statement in Oracle Reports Builder. The report was set up by a consultant about 3 yrs ago and we don't really have much skill in this area. What is happening when I try to modify the SQL statement, either adding a field or deleting a field to the SELECT statement, causes an error message preventing the statement from being saved. The only way out of the error message is to click Cancel. The error message is
ORA-00933:SQL command not properly ended
ORDER BY Program ==> NAME
Even adding or deleting a space anywhere in the SQL statement causes the error (not adding any new fields). A coworker found that if we comment out the ORDER BY, the statement will accept the new field in the SELECT section, however then we lose the order by functionality. I would like to add one additional field before the FROM. Not sure if any additional data are needed. Thank you.
SELECT p.person_uid PIDM_KEY, p.id_number ID,
p.full_name_lfmi name,
p.BIRTH_DATE, p.GENDER Sex,
Decode(a.residency,'D',p.Primary_ethnicity,'F') Ethn,
a.academic_period TERM,
CASE WHEN :p_group_by = 'PROGRAM' THEN a.program
ELSE ' '
END AS Program,
a.COLLEGE, a.degree, a.major, ' ' rule,
a.STUDENT_POPULATION,a.STUDENT_LEVEL, a.application_status Status, a.application_status_date app_sts_dte,
ad.decision_date1 Last_Dec_Date,
ad.decision1||' '||ad.decision2||' '|| ad.decision3||' '|| ad.decision4||' '|| ad.decision5 Decisions,
/* Deposit Date uses the last term entered in :p_term parameter string */
(SELECT MAX(deposit_effective_date) FROM usf_as_deposit WHERE account_uid = a.person_uid &term_clause group by account_uid) AS "DEPOSIT DATE",
ph.phone as PHONE,
CASE WHEN PS.FIRST_CONTACT IN ('NET','PAP','COM','COP') THEN PS.First_Contact
ELSE CASE WHEN ps.latest_contact IN ('NET','PAP','COM','COP') THEN PS.Latest_Contact
ELSE ' '
END
END AS FIRST_CONTACT,
DECODE(:p_address,'Y',REPLACE(adr.street1||' '||adr.street2||' '||adr.street3||' '||adr.city||','||adr.state||' '||adr.nation||' '||adr.zip,' ',' '),' ') as address, adr.nation, adr.state,
goremal_email_address email, a.residency, a.application_date, p.primary_ethnicity, c.cohort
FROM MST_ADMISSIONS_APPLICATION A,
MST_PERSON p,mst_pre_student PS, Admissions_Cohort c, usf_v_phone_pr_ma ph,
MST_admissions_decision_slot AD, usf_v_email, usf_v_address_dr_lr_ma_pr adr
WHERE a.PERSON_UID = p.person_uid
AND a.curriculum_priority = 1
AND a.person_uid = ps.person_uid
AND a.person_uid = ad.person_Uid(+)
AND a.person_uid = goremal_pidm(+)
AND a.person_uid = adr.pidm(+)
AND a.person_uid = ph.pidm(+)
AND ph.rnum(+) = 1
AND a.person_uid = c.person_uid(+)
AND a.academic_period = c.academic_period(+)
&Where_Clause
/* TAKE OUT FOLLOWING LINE AFTER DATA IS CLEANED UP */
AND NOT(p.id_number = '00000000' OR SUBSTR(p.id_number,1,1) = 'B' OR UPPER(p.full_name_lfmi) LIKE '%TESTING%')
AND a.application_status_date >= NVL(:p_as_of_date,sysdate-8000)
AND a.academic_period = ad.academic_period(+)
AND a.application_number = ad.application_number(+)
AND a.degree <> 'ND' /* AND a.college <> 'LW' -- Does not need non-degree and law students */
&Cohort_Clause
ORDER BY Program &ORDER_CLAUSEHi Denis,
I tried your suggestion. The good thing is that adding the comma allowed me to be able to add a.campus to the select statement, unfortunately, another error message happened.
ORA-00936: missing expression SELECT p . person_uid PIDM_KEY ,
p . id_number , p . full_name_lfmi name , p . BIRTH_DATE , p . GENDER Sex ,
Decode ( a . residency , 'D' , p . Primary_Ethnicity , 'F' ) Ethn , a . academic_period TERM ,
CASE WHEN : P_group_by = 'PROGRAM THEN a I started over and tried only putting in the comma and get the same message even though I didn't add campus. After that, removed the comma which led to the ORA-00933 error message. So once again, I had to close the file without saving, in order for the report to run at all. -
Need help in resolving the below error - SQL statement to execute cannot be
Here is my CO as below , which creates a callable statement.
try {
OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
OADBTransactionImpl t = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
OracleCallableStatement proc = (OracleCallableStatement)t.createCallableStatement(lquery, -1);
proc.execute();
t.commit();
catch(SQLException sqlexception)
throw OAException.wrapperException(sqlexception);
After running the page , getting the below error ... ( Please find the below error stack )
I reffered the developement guide but did not get helpful things.
Please provide me any clues on the same.
Regards Raghu
-- Error Stack ---------------------------------------------------------
Error Page
Exception Details.
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27123: SQL error during call statement preparation. Statement: null
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
at OA.jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
## Detail 0 ##
java.sql.SQLException: SQL statement to execute cannot be empty or null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
at OA.jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
java.sql.SQLException: SQL statement to execute cannot be empty or null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
at OA.jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
Edited by: Raghu on Sep 14, 2010 2:58 AMcheck the code pasted by me again
Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right oneThanks
--Anil -
ORA-00900: invalid SQL statement Error while Executing Procedure
Hi:
I am trying to execute following procedure through java code, but i am getting ORA-00900: invalid SQL statement error.
Procedure is :
<code>
(vResult out int)
as
vCardId varchar2(16);
vForacid varchar2(16);
vApp_Entry_No varchar2(10);
vSrNo number(6);
vCardStatus char(1);
vCardStat char(2);
vExpiryDate date;
Cursor cardCur1 is
select u.card_number,trim(u.ACCOUNT_NUMBER),u.CARD_STATUS,to_char(u.EXPIRY_DATE,'dd-MM-yyyy')
FROM DailyCardData u
where default_indicator='1'
and isprocessed = 'N'
order by expiry_date;
begin
vSrNo := 0;
vResult := 0;
open cardCur1;
Loop
fetch cardCur1 into vCardId,vForacid,vCardStat,vExpiryDate;
if cardCur1%NOTFOUND then
exit;
end if;
if (vCardStat != null) then
vCardStatus := 'H';
elsif (vExpiryDate <= sysdate) then
vCardStatus := 'E';
else
vCardStatus := null;
end if;
select a.app_entry_no into vApp_Entry_No from Application a,ApplicationLinkedAccounts l
where l.foracid = vForacid and l.AcSrNo = '1'
and a.app_entry_no = l.app_entry_no
and a.cardid is null
and a.DOWNLOADFILECREATIONFLAG = 'Y';
update Application set CardId = vCardId,
Card_Status = vCardStatus,APPLICATIONPROCESSEDFLAG = 'Y',
APPLICATIONPROCESSEDdate = DOWNLOADFILECREATIONdate
where App_Entry_No = vApp_Entry_No;
commit;
update DailyCardData set isprocessed = 'Y',app_entry_no = vApp_Entry_No
where card_number = vCardId;
commit;
end Loop;
close cardCur1;
vResult := 1;
end;
</code>
Can any body help me in that?
Thank You,
AnupFirst of all I don't see a procedure header.
Secondly I see you commit inside your procedure. This is a bug.
Thirdly I see you also commit inside a loop. This is also a bug, and needs to be removed asap.
The error indicates a statement doesn't parse. As you don't post the error stack, nor a table definition no one can reproduce the problem.
You need to isolate the statements, one by one, and run them through sql*plus to see what happens.
Sybrand Bakker
Senior Oracle DBA -
[0098]SQL*Plus encountered oracle error 100 while executing SQL Statement
Hi,
i'm trying to delete duplicate records from a table and running following script. this script is triggered from a unix script. it successfully deletes the records but in the last throws following error message,
:[0098]SQL*Plus encountered oracle error 100 while executing SQL Statement:2:Investigation required:
can anybody please help? below is the script.
DECLARE
--CURSOR FOR DUPLICATE ROWS
CURSOR CUR_DUPLICATE_ROWS IS
Select RMS_NOTE_ID, RMS_SUMMARY_NOTE_ID, count(*) cnt from PARTY_NOTE
group by RMS_NOTE_ID,RMS_SUMMARY_NOTE_ID having count(*) > 1;
var_date PARTY_NOTE.PARTY_NOTE_CREATED_DATE%TYPE;
BEGIN
FOR DUPLICATE_ROWS_REC IN CUR_DUPLICATE_ROWS
LOOP
delete from party_note
where RMS_NOTE_ID= DUPLICATE_ROWS_REC.RMS_NOTE_ID
and RMS_SUMMARY_NOTE_ID= DUPLICATE_ROWS_REC.RMS_SUMMARY_NOTE_ID
and rowid not in (select max(rowid) from party_note
where RMS_NOTE_ID= DUPLICATE_ROWS_REC.RMS_NOTE_ID and RMS_SUMMARY_NOTE_ID= DUPLICATE_ROWS_REC.RMS_SUMMARY_NOTE_ID);
commit;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ROLLBACK;
END;Try this:
delete party_note
where rowid not in (select max(rowid)
from party_note
group by rms_note_id, rms_summary_note_id
commit;No need for cursors and loops.
And when that's completed, consider ALTERing the table to add a unique index (or even a primary key) so you'll never need to do this again. -
Help in SQL statement!!
How to pass in the strings with commas in the SQL statement. I have a SQL statement which looks like this:
String query = "SELECT Product FROM Product where Risk LIKE "+ risk +" and Priority="+ priority +"";
And the 2 values that I'm going to pass in is "R1,R2" and "P1,P2"; When I run it, there is an error. May I know how to improve my SQL statement so that it can accept the two values. Thanx
I would have used keyword in instead ie
String query = "SELECT Product FROM Product where Risk IN "+ risk +" and Priority IN "+ priority ; -
SQL Statements in ABAP and meaning
Hello Friends,
Please, can anybody provide me a documentation on the different ABAP SQL statements and there usage/meanings.
Thanks,
Shreekanthi,
goto abapdocu->abap Database access->open Sql you will get examples.
for documnetation got se38->specify the command and press F1.
SELECT:
Put the curson on that word and press F1 . You can see the whole documentation for select statements.
SELECT result
FROM source
INTO|APPENDING target
[[FOR ALL ENTRIES IN itab] WHERE sql_cond]
Effect
SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects.
The select statement reads a result set (whose structure is determined in result ) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set.
The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops.
Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions.
System Fields
The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.
sy-subrc Relevance
0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.
4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.
8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.
After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.
Notes
Outside classes, you do not need to specify the target area with INTO or APPENDING if a single database table or a single view is specified statically after FROM, and a table work area dbtab was declared with the TABLES statement for the corresponding database table or view. In this case, the system supplements the SELECT-statement implicitly with the addition INTO dbtab.
Although the WHERE-condition is optional, you should always specify it for performance reasons, and the result set should not be restricted on the application server.
SELECT-loops can be nested. For performance reasons, you should check whether a join or a sub-query would be more effective.
Within a SELECT-loop you cannot execute any statements that lead to a database commit and consequently cause the corresponding database cursor to close.
SELECT - result
Syntax
... lines columns ... .
Effect The data in result defines whether the resulting set consists of multiple rows (table-like structure) or a single row ( flat structure). It specifies the columns to be read and defines their names in the resulting set. Note that column names from the database table can be changed. For single columns, aggregate expressions can be used to specify aggregates. Identical rows in the resulting set can be excluded, and individual rows can be protected from parallel changes by another program.
The data in result consists of data for the rows lines and for the columns columns.
SELECT - lines
Syntax
... { SINGLE }
| { { } } ... .
Alternatives:
1. ... SINGLE
2. ... { }
Effect
The data in lines specifies that the resulting set has either multiple lines or a single line.
Alternative 1
... SINGLE
Effect
If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.
An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE. The SELECT command is used in this case only if all primary key fields in logical expressions linked by AND are checked to make sure they are the same in the WHERE condition. Otherwise, the resulting set is empty and sy-subrc is set to 8. If the lock causes a deadlock, an exception occurs. If the FOR UPDATE addition is used, the SELECT command circumvents SAP buffering.
Note
When SINGLE is being specified, the lines to be read should be clearly specified in the WHERE condition, for the sake of efficiency. When the data is read from a database table, the system does this by specifying comparison values for the primary key.
Alternative 2
Effect
If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
If the system tries to access pool or cluster tables and single columns are specified in columns.
Note
When specifying DISTINCT, note that you have to carry out sort operations in the database system for this.
SELECT - columns
Syntax
| { {col1|aggregate( col1 )}
{col2|aggregate( col2 )} ... }
| (column_syntax) ... .
Alternatives:
1. ... *
2. ... {col1|aggregate( col1 )}
{col2|aggregate( col2 )} ...
3. ... (column_syntax)
Effect
The input in columns determines which columns are used to build the resulting set.
Alternative 1
Effect
If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views. Only one data object can be specified after INTO.
Note
If multiple database tables are specified after FROM, you cannot prevent multiple columns from getting the same name when you specify *.
Alternative 2
... {col1|aggregate( col1 )}
{col2|aggregate( col2 )} ...
Effect
A list of column labels col1 col2 ... is specified in order to build the resulting list from individual columns. An individual column can be specified directly or as an argument of an aggregate function aggregate. The order in which the column labels are specified is up to you and defines the order of the columns in the resulting list. Only if a column of the type LCHAR or LRAW is listed does the corresponding length field also have to be specified directly before it. An individual column can be specified multiple times.
The addition AS can be used to define an alternative column name a1 a2 ... with a maximum of fourteen digits in the resulting set for every column label col1 col2 .... The system uses the alternative column name in the additions INTO|APPENDING CORRESPONDING FIELDS and ORDER BY. .
http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm -
PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
제품 : PRECOMPILERS
작성날짜 : 2001-07-12
PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
==========================================================================
Pro*C에서 LOB를 사용하는 방법에는 다음 3가지가 있습니다.
(1) PL/SQL blocks에서 DBMS_LOB package를 이용하는 방법
(2) OCI function을 이용하는 방법
(3) Embedded SQL statements을 이용하는 방법
다음은 (3)번째 방법에 대한 pro*c에서 지원하는 명령어들입니다.
o APPEND: Appends lob value at the end of another LOB.
EXEC SQL LOB APPEND :src TO :dst;
o ASSIGN: Assigns LOB or BFILE locator to another.
EXEC SQL LOB ASSIGN :src TO :dst;
o CLOSE: Close LOB or BFILE.
EXEC SQL LOB CLOSE :src;
o COPY: Copy all or part of LOB value into another LOB.
EXEC SQL LOB COPY :amt FROM :src [AT :src_offset] TO :dst [AT dst_offset];
o CREATE TEMPORARY: Creates a temporary LOB.
EXEC SQL LOB CREATE TEMPORARY :src;
o ERASE: Erase the given amount of LOB data starting from a given offset.
EXEC SQL LOB ERASE :amt FROM :src [AT :src_offset];
o FILE CLOSE ALL: Closes all the BFILES open in the current session.
EXEC SQL LOB FILE CLOSE ALL;
o FILE SET: Set DIRECTORY alias and FILENAME in a BFILE locator.
EXEC SQL LOB FILE SET :file DIRECTORY = :alias, FILENAME = :filename;
o FREE TEMPORARY: Free the temporary space for the LOB locator.
EXEC SQL LOB FREE TEMPORARY :src
o LOAD FROM FILE: Copy all or part of BFIL into an internal LOB.
EXEC SQL LOB LOAD :amt FROM FILE :file [AT :src_offset]
INTO :dst [AT :dst_offset];
o OPEN: Open a LOB or BFILE for read or read/write.
EXEC SQL LOB OPEN :src [ READ ONLY | READ WRITE ];
o READ: Reads all or part of LOB or BFILE into a buffer.
EXEC SQL LOB READ :amt FROM :src [AT :src_offset]
INTO :buffer [WITH LENGTH :buffer];
o TRIM: Truncates the LOB vlaue.
EXEC SQL LOB TRIM :src to :newlen;
o WRITE: Writes contents of the buffer to a LOB.
EXEC SQL LOB WRITE [APPEND] [FIRST | NEXT | LAST | ONE ]
:amt FROM :buffer [WITH LENGTH :buflen] INTO :dst [AT :dst_offset];
o DESCRIBE: Retrieves the attributes from a LOB.
EXEC SQL LOB DESCRIBE :src GET attribute1 [{, attributeN}]
INTO :hv1 [[INDICATOR] :hv_ind1] [{, :hvN [[INDICATOR] :hv_indN] }];
Attributes can be any of the following:
CHUNKSIZE: chunk size used to store the LOB value
DIRECTORY: name of the DIRECTORY alias for BFILE
FILEEXISTS: whether BFILE exists or not
FILENAME: BFILE name
ISOPEN: whether BFILE with this locate is OPEN or not
ISTEMPORARY: whether specified LOB is temporary or not
LENGTH: Length of BLOBs and BFILE in bytes, CLOBs and NCLOBs
in characters.
다음은 LOB를 사용하는 sample을 실행하는 방법입니다.
1. 먼저 scott user에서 다음을 실행합니다. (create directory를 할 수 있는 권한이
있어야 하며, directory는 사용하시는 환경에 맞도록 수정해 주십시요.)
drop table lob_table;
create table lob_table (key number, a_blob BLOB, a_clob CLOB);
drop table lobdemo;
create table lobdemo (key number, a_blob BLOB, a_bfile BFILE);
drop directory dir_alias;
create directory dir_alias as '/users/app/oracle/product/8.1.7/precomp/demo/proc';
insert into lob_table values(1, utl_raw.cast_to_raw('1111111111'), 'aaaaaaaa');
commit;
2. 다음 코드는 out.gif 파일을 위에서 지정한 directory에 만들고 lob_table의
내용에 들어있는 BLOB의 내용을 저장하는 sample입니다.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
/* Define constants for VARCHAR lengths. */
#define UNAME_LEN 20
#define PWD_LEN 40
/* Declare variables. No declare section is
needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* The following 3 lines avoid inclusion of oci.h during precompilation
oci.h is needed only during compilation to resolve calls generated by
the precompiler
#ifndef ORA_PROC
#include <oci.h>
#endif
#include <sqlca.h>
OCIBlobLocator *blob;
OCIClobLocator *clob;
FILE *fp;
unsigned int amt, offset = 1;
#define MAXBUFLEN 5000
unsigned char buffer[MAXBUFLEN];
EXEC SQL VAR buffer IS RAW(MAXBUFLEN);
/* Declare error handling function. */
void sql_error(msg)
char *msg;
char err_msg[128];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);
EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
void main()
/* Connect to ORACLE--
* Copy the username into the VARCHAR.
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);
/* Copy the password. */
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
/* Allocate the LOB host variables and select the BLOB value */
EXEC SQL ALLOCATE :blob;
EXEC SQL ALLOCATE :clob;
EXEC SQL SELECT a_blob INTO :blob FROM lob_table WHERE key=1;
/* Open external file to which BLOB value should be written */
fp = fopen("out.gif", "w");
EXEC SQL WHENEVER NOT FOUND GOTO end_of_lob;
amt = 5000;
EXEC SQL LOB READ :amt FROM :blob AT :offset INTO :buffer;
fwrite(buffer, MAXBUFLEN, 1, fp);
EXEC SQL WHENEVER NOT FOUND DO break;
/* Use polling method to continue reading the next pieces */
while (TRUE)
EXEC SQL LOB READ :amt FROM :blob INTO :buffer;
fwrite(buffer, MAXBUFLEN, 1, fp);
end_of_lob:
fwrite(buffer, amt, 1, fp);
printf("\nG'day.\n\n\n");
/* Disconnect from ORACLE. */
EXEC SQL ROLLBACK WORK RELEASE;
exit(EXIT_SUCCESS);
3. 다음 코드는 위에서 만든 out.gif file을 lobdemo에 저장하는 sample입니다.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
/* Define constants for VARCHAR lengths. */
#define UNAME_LEN 20
#define PWD_LEN 40
/* Declare variables. No declare section is
needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* The following 3 lines avoid inclusion of oci.h during precompilation
oci.h is needed only during compilation to resolve call generated by
the precompiler
#ifndef ORA_PROC
#include <oci.h>
#endif
#include <sqlca.h>
OCIBlobLocator *blob;
OCIBFileLocator *bfile;
char *alias = "DIR_ALIAS";
char *filename = "out.gif";
unsigned int amt = 50;
unsigned int filelen;
/* Declare error handling function. */
void sql_error(msg)
char *msg;
char err_msg[128];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);
EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
void main()
/* Connect to ORACLE--
* Copy the username into the VARCHAR.
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);
/* Copy the password. */
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
/* Allocate the LOB locator */
EXEC SQL ALLOCATE :blob;
EXEC SQL ALLOCATE :bfile;
/* Initialize the DIRECTORY alias of the BFILE and FILENAME */
EXEC SQL LOB FILE SET :bfile
DIRECTORY = :alias, FILENAME = :filename;
EXEC SQL INSERT INTO lobdemo values (1, EMPTY_BLOB(), :bfile);
EXEC SQL SELECT a_blob, a_bfile INTO :blob, :bfile FROM lobdemo
WHERE key = 1;
EXEC SQL LOB OPEN :bfile;
/* Get the BFILE length */
EXEC SQL LOB DESCRIBE :bfile
GET LENGTH INTO :filelen;
printf("File length is: %d\n", filelen);
amt = filelen;
/* Read BFILE and write to BLOB */
EXEC SQL LOB LOAD :amt FROM FILE :bfile INTO :blob;
EXEC SQL LOB CLOSE :bfile;
printf("\nG'day.\n\n\n");
/* Disconnect from ORACLE. */
EXEC SQL COMMIT WORK RELEASE;
exit(EXIT_SUCCESS);
4. 다음은 실행한 결과 입니다.
첫번째 sample :
Connected to ORACLE as user: SCOTT
G'day.
두번째 sample :
Connected to ORACLE as user: SCOTT
File length is: 10
G'day. -
JBO-26041: Failed to post data to database during "Insert": SQL Statement "
Dear All,
I am trying to insert the data into custom table,getting the following error. Please help me to resolve the issues.
I have created one custom table in APPS schema having the primary key and History Columns.
Created the EO based on the custom table and generate the create method.
Created the VO based on the EO and generated the VOImpl, RowImpl Java Files.
I am using the PER_PEOPLE_S sequence to populate the value into Primary key column.
Calling the below code into create method of EO object to populate the value into Primarykey column.
setPersPersonid(getOADBTransaction().getSequenceValue("PER_PEOPLE_S"));
oracle.apps.fnd.framework.OAException: oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO XXUTS_PERSON_T(PERS_PERSONID,PERS_FIRSTNAME,PERS_LASTNAME,CREATION_DATE,CREATED_BY,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN) VALUES (?,?,?,?,?,?,?,?)".
at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
at xxuts.oracle.apps.csc.person.webui.XXCreatePersonCO.processFormRequest(XXCreatePersonCO.java:67)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:72)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
java.sql.SQLException: ORA-00911: invalid character
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:427)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5740)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4539)
at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(Unknown Source)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2996)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2807)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1971)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2173)
at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(Unknown Source)
at xxuts.oracle.apps.csc.person.server.XXPersonMainAMImpl.savePersonToDatabase(XXPersonMainAMImpl.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
at xxuts.oracle.apps.csc.person.webui.XXCreatePersonCO.processFormRequest(XXCreatePersonCO.java:67)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:72)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
java.sql.SQLException: ORA-00911: invalid character
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:427)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5740)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4539)
at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(Unknown Source)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2996)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2807)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1971)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2173)
at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(Unknown Source)
at xxuts.oracle.apps.csc.person.server.XXPersonMainAMImpl.savePersonToDatabase(XXPersonMainAMImpl.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
at xxuts.oracle.apps.csc.person.webui.XXCreatePersonCO.processFormRequest(XXCreatePersonCO.java:67)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:72)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Thanksm
Sai SankilisettyDear Kumar,
I have checked the datatypes of the table and datatypes of the Pageitems, both the datatypes are same.
I have created the region using the wizard based on the VO.
My custom table having only 3 columns and History Columns.Out of 3 columns PersPersonid is Primary key column and I am assigning the sequence value to the column in create method of EO as below
public void create(AttributeList attributeList) {
super.create(attributeList);
setPersPersonid(getOADBTransaction().getSequenceValue("PER_PEOPLE_S"));
//Here PER_PEOPLE_S is the Sequence
Thanks,
Sai -
CALL PROCEDURE IN SQL STATEMENT
Why we cant call a procedure inside SQL statement?
Hitesh Nirkhey wrote:
Hi Karthick_Arp
as you said
The procedure that is used inside a function cannot contain DDL or DML statements or COMMIT/ROLLBACK.
Said that it does not make much sence to use a procedure within a function.IT make sense if we DECLARE FUNCTION AS PRAGMA AUTONOMUS_TRANSACTION
then we can execute DDL or DML statements or COMMIT/ROLLBACK in that function.
Regards
HiteshBut why would you do that? -
This SQL statement always in Top Activity, with PX Deq Credit: send blkd
Hi gurus,
The following SQL statement is always among the Top Activity. I can see the details in Enerprise manager that it suffers from PX Deq Credit: send blkd
This is the statement:
SELECT S.Product, S.WH_CODE, S.RACK, S.BATCH, S.EXP_DATE, FLOOR(Qty_Beg) QtyBeg_B,
ROUND(f_convert_qty(S.PRODUCT, Qty_Beg-FLOOR(Qty_Beg), P.UOM_K ), 0) QtyBeg_K,
FLOOR(Qty_In) QtyIn_B, ROUND(f_convert_qty(S.PRODUCT, Qty_In-FLOOR(Qty_In), P.UOM_K), 0) QtyIn_K,
FLOOR(Qty_Out) QtyOut_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Out-FLOOR(Qty_Out), P.UOM_K ), 0) QtyOut_K,
FLOOR(Qty_Adj) QtyAdj_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Adj-FLOOR(Qty_Adj), P.UOM_K ), 0) QtyAdj_K,
FLOOR(Qty_End) QtyEnd_B, ROUND(f_convert_qty(S.PRODUCT, Qty_End-FLOOR(Qty_End), P.UOM_K ), 0) QtyEnd_K,
S.LOC_CODE
FROM V_STOCK_DETAIL S
JOIN PRODUCTS P ON P.PRODUCT = S.PRODUCT
WHERE S.Product = :pProduct AND S.WH_CODE = :pWhCode AND S.LOC_CODE = :pLocCode;The statement is invoked by our front end (web based app) for a browse table displayed on a web page. The result can be 10 to 8000. It is used to display the current stock availability for a particular product in a particular warehouse. The stock availability it self is kept in a View : V_Stock_Detail
These are the parameters relevant to the optimizer:
SQL> show parameter user_dump_dest
user_dump_dest string /u01/app/oracle/admin/ITTDB/udump
SQL> show parameter optimizer
_optimizer_cost_based_transformation string OFF
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.2.0.3
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
SQL> show parameter db_file_multi
db_file_multiblock_read_count integer 16
SQL> show parameter db_block_size column sname format a20 column pname format a20
db_block_size integer 8192Here is the output of EXPLAIN PLAN:
SQL> explain plan for
SELECT S.Product, S.WH_CODE, S.RACK, S.BATCH, S.EXP_DATE, FLOOR(Qty_Beg) QtyBeg_B,
ROUND(f_convert_qty(S.PRODUCT, Qty_Beg-FLOOR(Qty_Beg), P.UOM_K ), 0) QtyBeg_K,
FLOOR(Qty_In) QtyIn_B, ROUND(f_convert_qty(S.PRODUCT, Qty_In-FLOOR(Qty_In), P.UOM_K), 0) QtyIn_K,
FLOOR(Qty_Out) QtyOut_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Out-FLOOR(Qty_Out), P.UOM_K ), 0) QtyOut_K,
FLOOR(Qty_Adj) QtyAdj_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Adj-FLOOR(Qty_Adj), P.UOM_K ), 0) QtyAdj_K,
FLOOR(Qty_End) QtyEnd_B, ROUND(f_convert_qty(S.PRODUCT, Qty_End-FLOOR(Qty_End), P.UOM_K ), 0) QtyEnd_K,
S.LOC_CODE
FROM V_STOCK_DETAIL S
JOIN PRODUCTS P ON P.PRODUCT = S.PRODUCT
WHERE S.Product = :pProduct AND S.WH_CODE = :pWhCode AND S.LOC_CODE = :pLocCode
Explain complete.
Elapsed: 00:00:00:31
SQL> select * from table(dbms_xplan.display)
PLAN_TABLE_OUTPUT
Plan hash value: 3252950027
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |IN-OUT| PQ
Distrib |
| 0 | SELECT STATEMENT | | 1 | 169 | 6 (17)| 00:00:01 | | |
|
| 1 | PX COORDINATOR | | | | | | | |
|
| 2 | PX SEND QC (RANDOM) | :TQ10003 | 1 | 169 | 6 (17)| 00:00:01 | Q1,03 | P->S | QC
(RAND) |
| 3 | HASH GROUP BY | | 1 | 169 | 6 (17)| 00:00:01 | Q1,03 | PCWP |
|
| 4 | PX RECEIVE | | 1 | 169 | 6 (17)| 00:00:01 | Q1,03 | PCWP |
|
| 5 | PX SEND HASH | :TQ10002 | 1 | 169 | 6 (17)| 00:00:01 | Q1,02 | P->P | HA
SH |
| 6 | HASH GROUP BY | | 1 | 169 | 6 (17)| 00:00:01 | Q1,02 | PCWP |
|
| 7 | NESTED LOOPS OUTER | | 1 | 169 | 5 (0)| 00:00:01 | Q1,02 | PCWP |
|
| 8 | MERGE JOIN CARTESIAN | | 1 | 119 | 4 (0)| 00:00:01 | Q1,02 | PCWP |
|
| 9 | SORT JOIN | | | | | | Q1,02 | PCWP |
|
| 10 | NESTED LOOPS | | 1 | 49 | 4 (0)| 00:00:01 | Q1,02 | PCWP |
|
| 11 | BUFFER SORT | | | | | | Q1,02 | PCWC |
|
| 12 | PX RECEIVE | | | | | | Q1,02 | PCWP |
|
| 13 | PX SEND BROADCAST | :TQ10000 | | | | | | S->P | BR
OADCAST |
|* 14 | INDEX RANGE SCAN | PRODUCTS_IDX2 | 1 | 25 | 2 (0)| 00:00:01 | | |
|
| 15 | PX BLOCK ITERATOR | | 1 | 24 | 2 (0)| 00:00:01 | Q1,02 | PCWC |
|
|* 16 | MAT_VIEW ACCESS FULL | MV_CONVERT_UOM | 1 | 24 | 2 (0)| 00:00:01 | Q1,02 | PCWP |
|
| 17 | BUFFER SORT | | 1 | 70 | 2 (0)| 00:00:01 | Q1,02 | PCWP |
|
| 18 | BUFFER SORT | | | | | | Q1,02 | PCWC |
|
| 19 | PX RECEIVE | | 1 | 70 | 4 (0)| 00:00:01 | Q1,02 | PCWP |
|
| 20 | PX SEND BROADCAST | :TQ10001 | 1 | 70 | 4 (0)| 00:00:01 | | S->P | BR
OADCAST |
|* 21 | TABLE ACCESS BY INDEX ROWID| STOCK | 1 | 70 | 4 (0)| 00:00:01 | | |
|
|* 22 | INDEX RANGE SCAN | STOCK_PK | 1 | | 2 (0)| 00:00:01 | | |
|
|* 23 | TABLE ACCESS BY INDEX ROWID | MV_TRANS_STOCK | 1 | 50 | 3 (0)| 00:00:01 | Q1,02 | PCWP |
|
|* 24 | INDEX RANGE SCAN | MV_TRANS_STOCK_IDX1 | 1 | | 2 (0)| 00:00:01 | Q1,02 | PCWP |
|
Predicate Information (identified by operation id):
14 - access("P"."PRODUCT"=:PPRODUCT)
16 - filter("CON"."PRODUCT"=:PPRODUCT)
21 - filter("STOCK"."LOC_CODE"=:PLOCCODE)
22 - access("STOCK"."PRODUCT"=:PPRODUCT AND "STOCK"."WH_CODE"=:PWHCODE)
23 - filter("STS"(+)='N')
24 - access("PRODUCT"(+)=:PPRODUCT AND "WH_CODE"(+)=:PWHCODE AND "LOC_CODE"(+)=:PLOCCODE AND "RACK"(+)="STOCK"."RACK" AND
"BATCH"(+)="STOCK"."BATCH" AND "EXP_DATE"(+)="STOCK"."EXP_DATE")
42 rows selected.
Elapsed: 00:00:00:06Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
SQL> SELECT S.Product, S.WH_CODE, S.RACK, S.BATCH, S.EXP_DATE, FLOOR(Qty_Beg) QtyBeg_B,
ROUND(f_convert_qty(S.PRODUCT, Qty_Beg-FLOOR(Qty_Beg), P.UOM_K ), 0) QtyBeg_K,
FLOOR(Qty_In) QtyIn_B, ROUND(f_convert_qty(S.PRODUCT, Qty_In-FLOOR(Qty_In), P.UOM_K), 0) QtyIn_K,
FLOOR(Qty_Out) QtyOut_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Out-FLOOR(Qty_Out), P.UOM_K ), 0) QtyOut_K,
FLOOR(Qty_Adj) QtyAdj_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Adj-FLOOR(Qty_Adj), P.UOM_K ), 0) QtyAdj_K,
FLOOR(Qty_End) QtyEnd_B, ROUND(f_convert_qty(S.PRODUCT, Qty_End-FLOOR(Qty_End), P.UOM_K ), 0) QtyEnd_K,
S.LOC_CODE
FROM V_STOCK_DETAIL S
JOIN PRODUCTS P ON P.PRODUCT = S.PRODUCT
WHERE S.Product = :pProduct AND S.WH_CODE = :pWhCode AND S.LOC_CODE = :pLocCode
Execution Plan
0 SELECT STATEMENT Optimizer Mode=ALL_ROWS 1 169 6
1 0 PX COORDINATOR
2 1 PX SEND QC (RANDOM) SYS.:TQ10003 1 169 6 :Q1003 P->S QC (RANDOM)
3 2 HASH GROUP BY 1 169 6 :Q1003 PCWP
4 3 PX RECEIVE 1 169 6 :Q1003 PCWP
5 4 PX SEND HASH SYS.:TQ10002 1 169 6 :Q1002 P->P HASH
6 5 HASH GROUP BY 1 169 6 :Q1002 PCWP
7 6 NESTED LOOPS OUTER 1 169 5 :Q1002 PCWP
8 7 MERGE JOIN CARTESIAN 1 119 4 :Q1002 PCWP
9 8 SORT JOIN :Q1002 PCWP
10 9 NESTED LOOPS 1 49 4 :Q1002 PCWP
11 10 BUFFER SORT :Q1002 PCWC
12 11 PX RECEIVE :Q1002 PCWP
13 12 PX SEND BROADCAST SYS.:TQ10000 S->P BROADCAST
14 13 INDEX RANGE SCAN ITT_NEW.PRODUCTS_IDX2 1 25 2
15 10 PX BLOCK ITERATOR 1 24 2 :Q1002 PCWC
16 15 MAT_VIEW ACCESS FULL ITT_NEW.MV_CONVERT_UOM 1 24 2 :Q1002 PCWP
17 8 BUFFER SORT 1 70 2 :Q1002 PCWP
18 17 BUFFER SORT :Q1002 PCWC
19 18 PX RECEIVE 1 70 4 :Q1002 PCWP
20 19 PX SEND BROADCAST SYS.:TQ10001 1 70 4 S->P BROADCAST
21 20 TABLE ACCESS BY INDEX ROWID ITT_NEW.STOCK 1 70 4
22 21 INDEX RANGE SCAN ITT_NEW.STOCK_PK 1 2
23 7 TABLE ACCESS BY INDEX ROWID ITT_NEW.MV_TRANS_STOCK 1 50 3 :Q1002 PCWP
24 23 INDEX RANGE SCAN ITT_NEW.MV_TRANS_STOCK_IDX1 1 2 :Q1002 PCWP
Statistics
570 recursive calls
0 physical write total IO requests
0 physical write total multi block requests
0 physical write total bytes
0 physical writes direct temporary tablespace
0 java session heap live size max
0 java session heap object count
0 java session heap object count max
0 java session heap collected count
0 java session heap collected bytes
83 rows processed
Elapsed: 00:00:03:24
SQL> disconnect
Commit complete
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining optionsThe TKPROF output for this statement looks like the following:
TKPROF: Release 10.2.0.3.0 - Production on Thu Apr 23 12:39:29 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: ittdb_ora_9566_mytrace1.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
SELECT S.Product, S.WH_CODE, S.RACK, S.BATCH, S.EXP_DATE, FLOOR(Qty_Beg) QtyBeg_B,
ROUND(f_convert_qty(S.PRODUCT, Qty_Beg-FLOOR(Qty_Beg), P.UOM_K ), 0) QtyBeg_K,
FLOOR(Qty_In) QtyIn_B, ROUND(f_convert_qty(S.PRODUCT, Qty_In-FLOOR(Qty_In), P.UOM_K), 0) QtyIn_K,
FLOOR(Qty_Out) QtyOut_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Out-FLOOR(Qty_Out), P.UOM_K ), 0) QtyOut_K,
FLOOR(Qty_Adj) QtyAdj_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Adj-FLOOR(Qty_Adj), P.UOM_K ), 0) QtyAdj_K,
FLOOR(Qty_End) QtyEnd_B, ROUND(f_convert_qty(S.PRODUCT, Qty_End-FLOOR(Qty_End), P.UOM_K ), 0) QtyEnd_K,
S.LOC_CODE
FROM V_STOCK_DETAIL S
JOIN PRODUCTS P ON P.PRODUCT = S.PRODUCT
WHERE S.Product = :pProduct AND S.WH_CODE = :pWhCode AND S.LOC_CODE = :pLocCode
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.04 0.12 0 10 4 0
Fetch 43 0.05 2.02 0 73 0 83
total 45 0.10 2.15 0 83 4 83
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 164
Rows Row Source Operation
83 PX COORDINATOR (cr=83 pr=0 pw=0 time=2086576 us)
0 PX SEND QC (RANDOM) :TQ10003 (cr=0 pr=0 pw=0 time=0 us)
0 HASH GROUP BY (cr=0 pr=0 pw=0 time=0 us)
0 PX RECEIVE (cr=0 pr=0 pw=0 time=0 us)
0 PX SEND HASH :TQ10002 (cr=0 pr=0 pw=0 time=0 us)
0 HASH GROUP BY (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us)
0 MERGE JOIN CARTESIAN (cr=0 pr=0 pw=0 time=0 us)
0 SORT JOIN (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
0 BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
0 PX RECEIVE (cr=0 pr=0 pw=0 time=0 us)
0 PX SEND BROADCAST :TQ10000 (cr=0 pr=0 pw=0 time=0 us)
1 INDEX RANGE SCAN PRODUCTS_IDX2 (cr=2 pr=0 pw=0 time=62 us)(object id 135097)
0 PX BLOCK ITERATOR (cr=0 pr=0 pw=0 time=0 us)
0 MAT_VIEW ACCESS FULL MV_CONVERT_UOM (cr=0 pr=0 pw=0 time=0 us)
0 BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
0 BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
0 PX RECEIVE (cr=0 pr=0 pw=0 time=0 us)
0 PX SEND BROADCAST :TQ10001 (cr=0 pr=0 pw=0 time=0 us)
83 TABLE ACCESS BY INDEX ROWID STOCK (cr=78 pr=0 pw=0 time=1635 us)
83 INDEX RANGE SCAN STOCK_PK (cr=4 pr=0 pw=0 time=458 us)(object id 135252)
0 TABLE ACCESS BY INDEX ROWID MV_TRANS_STOCK (cr=0 pr=0 pw=0 time=0 us)
0 INDEX RANGE SCAN MV_TRANS_STOCK_IDX1 (cr=0 pr=0 pw=0 time=0 us)(object id 143537)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
PX Deq: Join ACK 17 0.00 0.00
PX qref latch 2 0.00 0.00
PX Deq Credit: send blkd 72 1.95 2.00
PX Deq: Parse Reply 26 0.01 0.01
SQL*Net message to client 43 0.00 0.00
PX Deq: Execute Reply 19 0.00 0.01
SQL*Net message from client 43 0.00 0.04
PX Deq: Signal ACK 12 0.00 0.00
enq: PS - contention 1 0.00 0.00
********************************************************************************The DBMS_XPLAN.DISPLAY_CURSOR output:
SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'))
PLAN_TABLE_OUTPUT
SQL_ID 402b8st7vt6ku, child number 2
SELECT /*+ gather_plan_statistics */ S.Product, S.WH_CODE, S.RACK, S.BATCH, S.EXP_DATE, FLOOR(Qty_Beg) QtyBeg_B,
ROUND(f_convert_qty(S.PRODUCT, Qty_Beg-FLOOR(Qty_Beg), P.UOM_K ), 0) QtyBeg_K, FLOOR(Qty_In) QtyIn_B, ROUND(f_convert_qty(S.P
RODUCT,
Qty_In-FLOOR(Qty_In), P.UOM_K), 0) QtyIn_K, FLOOR(Qty_Out) QtyOut_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Out-FLOOR(Qty_Out), P
.UOM_K ),
0) QtyOut_K, FLOOR(Qty_Adj) QtyAdj_B, ROUND(f_convert_qty(S.PRODUCT, Qty_Adj-FLOOR(Qty_Adj), P.UOM_K ), 0) QtyAdj_K,
FLOOR(Qty_End) QtyEnd_B, ROUND(f_convert_qty(S.PRODUCT, Qty_End-FLOOR(Qty_End), P.UOM_K ), 0) QtyEnd_K, S.LOC_CODE FROM
V_STOCK_DETAIL S JOIN PRODUCTS P ON P.PRODUCT = S.PRODUCT WHERE S.Product = :pProduct AND S.WH_CODE = :pWhCode AND S.LOC
_CODE =
:pLocCode
Plan hash value: 3252950027
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem |
1Mem | Used-Mem |
| 1 | PX COORDINATOR | | 1 | | 83 |00:00:02.25 | 83 | |
| |
| 2 | PX SEND QC (RANDOM) | :TQ10003 | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 3 | HASH GROUP BY | | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 4 | PX RECEIVE | | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 5 | PX SEND HASH | :TQ10002 | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 6 | HASH GROUP BY | | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 7 | NESTED LOOPS OUTER | | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 8 | MERGE JOIN CARTESIAN | | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 9 | SORT JOIN | | 0 | | 0 |00:00:00.01 | 0 | 73728 |
73728 | |
| 10 | NESTED LOOPS | | 0 | 1 | 0 |00:00:00.01 | 0 | |
| |
| 11 | BUFFER SORT | | 0 | | 0 |00:00:00.01 | 0 | 73728 |
73728 | |
| 12 | PX RECEIVE | | 0 | | 0 |00:00:00.01 | 0 | |
| |
| 13 | PX SEND BROADCAST | :TQ10000 | 0 | | 0 |00:00:00.01 | 0 | |
| |
|* 14 | INDEX RANGE SCAN | PRODUCTS_IDX2 | 1 | 1 | 1 |00:00:00.01 | 2 | |
| |
| 15 | PX BLOCK ITERATOR | | 0 | 1 | 0 |00:00:00.01 | 0 | |
| |
|* 16 | MAT_VIEW ACCESS FULL | MV_CONVERT_UOM | 0 | 1 | 0 |00:00:00.01 | 0 | |
| |
| 17 | BUFFER SORT | | 0 | 21 | 0 |00:00:00.01 | 0 | 73728 |
73728 | |
| 18 | BUFFER SORT | | 0 | | 0 |00:00:00.01 | 0 | 73728 |
73728 | |
| 19 | PX RECEIVE | | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
| 20 | PX SEND BROADCAST | :TQ10001 | 0 | 21 | 0 |00:00:00.01 | 0 | |
| |
|* 21 | TABLE ACCESS BY INDEX ROWID| STOCK | 1 | 21 | 83 |00:00:00.01 | 78 | |
| |
|* 22 | INDEX RANGE SCAN | STOCK_PK | 1 | 91 | 83 |00:00:00.01 | 4 | |
| |
|* 23 | TABLE ACCESS BY INDEX ROWID | MV_TRANS_STOCK | 0 | 1 | 0 |00:00:00.01 | 0 | |
| |
|* 24 | INDEX RANGE SCAN | MV_TRANS_STOCK_IDX1 | 0 | 1 | 0 |00:00:00.01 | 0 | |
| |
Predicate Information (identified by operation id):
14 - access("P"."PRODUCT"=:PPRODUCT)
16 - access(:Z>=:Z AND :Z<=:Z)
filter("CON"."PRODUCT"=:PPRODUCT)
21 - filter("STOCK"."LOC_CODE"=:PLOCCODE)
22 - access("STOCK"."PRODUCT"=:PPRODUCT AND "STOCK"."WH_CODE"=:PWHCODE)
23 - filter("STS"='N')
24 - access("PRODUCT"=:PPRODUCT AND "WH_CODE"=:PWHCODE AND "LOC_CODE"=:PLOCCODE AND "RACK"="STOCK"."RACK" AND "BATCH"="STOCK"."B
ATCH" AND
"EXP_DATE"="STOCK"."EXP_DATE")
53 rows selected.
Elapsed: 00:00:00:12I'm looking forward for suggestions how to improve the performance of this statement.
Thank you very much,
xtantoxtanto wrote:
Hi sir,
How to prevent the query from doing parallel query ?
Because as you see actually I am not issuing any Parallel hints in the query.
Thank you,
xtantoKristanto,
there are a couple of points to consider:
1. Your SQL*Plus version seems to be outdated. Please use a SQL*Plus version that corresponds to your database version. E.g. the AUTOTRACE output is odd.
2. I would suggest to repeat your exercise using serial execution (the plan, the autotrace, the tracing). You can disable parallel queries by issuing this in your session:
ALTER SESSION DISABLE PARALLEL QUERY;
This way the output of the tools is much more meaningful, however you might get a different execution plan, therefore the results might not be representative for your parallel execution.
3. The function calls might pose a problem. If they are, one possible damage limitation has been provided by hoek. Even better would be then to replace the PL/SQL function with equivalent plain SQL. However since you say that it generates not too many rows it might not harm here too much. You can check the impact of the functions by running a similar query but omitting the function calls.
4. The parallel execution plan contains a MERGE JOIN CARTESIAN operation which could be an issue if the estimates of the optimizer are incorrect. If the serial execution still uses this operation the TKPROF and DBMS_XPLAN.DISPLAY_CURSOR output will reveal whether this is a problem or not.
5. The execution of the statement seems to take on 2-3 seconds in your tests. Is this in the right ballpark? If yes, why should this statement then be problematic? How often does it get executed?
6. The statement uses bind variables, so you might have executions that use different execution plans depending on the bind values passed when the statement got optimized. You can use DBMS_XPLAN.DISPLAY_CURSOR using NULL as "child_number" parameter or DBMS_XPLAN.DISPLAY_AWR (if you have a AWR license) to check if you have multiple execution plans for the statement. Please note that older versions might have already been aged out of the shared pool, so the AWR repository might be a more reliable source (but only if the statement has been sampled).
7. You have disabled cost based transformations: "_optimizer_cost_based_transformation" = OFF. Why?
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/
Maybe you are looking for
-
Itunes will open, but my ipod doesn't appear on the screen
i plug my ipod in and itunes pops up, my my ipod stuff doesn't! i wait for a bit, but my ipod is kind of frozen and it doesn't have that little sync icon in the corner. i disconect it and try to turn it off, but its frozen, so i leave it overnight an
-
Hello, Ok I have a wmv file. Inserted into timeline. Audio track goes to track 4. When I unlink and try to move up to audio track one it doesn't move. It can't drag. Not sure if I set something up wrong in my sequence, also I notice in audio tra
-
Collecting Message based on Delivery Id
Hi, We have an scenario to collect the messages based on delviery number, like customer sends the bulk order and SAP splits that order and create the delivery for each splitted orders . Eg. Sales Order Batch Order PO# 1234 This Batch order i
-
I can't copy paste from pdf to word due to Unicode character problem.
I was able to copy paste from a pdf document on word and all of a sudden it won't let me paste anymore. Well, I can paste the text but it come up as 'square' thingy. The spanner icon lights up and says This document contains unicode characters that m
-
Separate flattened data with unknown number of columns
Hi I am working on a runbook for a customer which returns the number of windows updates in a software update group and sends an email. Currently only the update title is returned from the SQL query and that activity is flattened with line breaks to g