Retrieve Crystal SQL statements without first submitting parameter values?
Hi,
I am retrieving SQL statements for Crystal reports without issue, but a large number of our reports have parameters and for these the following error is thrown when I try to retrieve the SQL statement via RAS using getSQLStatement():
com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Missing parameter values.---- Error code:-2147217394 Error code name:missingParameterValueError
I have a large number of reports I'd like to pull SQL for, so it's not feasible to have my script push parameter values to each and every report. Is there a way to retrieve SQL statements without first pushing parameter values?
Thanks
Hello Jeremy.
I found a Knowledge Base article that deals with the "Error code:-2147217394 Error code name:missingParameterValueError" error that you mention. Perhaps you could take a look at the following KBase Article in the Service MarketPlace and see if any of it applies to your situation:
KBase number: 1420593
I also found KBase number "1420501 - Report parameters ignored when set by Java post processing code" that seems to deal with the same problem.
Regards.
- Robert
Similar Messages
-
SQL Statement ignored performing List of Values query
Hi, New user just learning the basics. I have created a simple table PERSON with columns, ID, firstname, lastname, phone, city, State_ID
Then clicked create Lookup table - State_Lookup with columns State_ID and State_Name.
I create a page, include all columns from PERSON. For State the field is a select list that should do a lookup form the STATE_LOOKUP table. (I have entered 4 states in the table)
I am getting the following error however:
Error: ORA-06550: line 1, column 14: PL/SQL: ORA-00904: "STATE_ID": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored performing List of Values query: "select STATE_ID d, STATE_ID v from STATE_ID_LOOKUP order by 1".
I have not entered any sql, just selected all of my options using defaults and dropdowns. What is causing the error and what do I need to change?
ThanksOkay, learned something: The database link name used, must not contain a dash. The DB_DOMAIN is appended automatically when you create a DB link, so if IT contains a dash, the db link name does as well. Check DBA_DB_LINKS to make sure you don't hit this well-hidden feature.
Regards
Martin Klier
[http://www.usn-it.de|http://www.usn-it.de] -
Parsing a sql statement without executing it
Hello everybody,
I'd like to know a way of parsing sql statements in order to validate them, thus I'd get the error messages beforehand without executing them.
Here we have the hard task of analyzing several sql scripts and then sending corrections to the development team and thirty party companies before applying them in our production databases. I'm willing to create a web/pl sql program that does such hard task, at least a program that identify basic errors such as missing table owner, non-existing tables, sintax errors and so on...
Any tip will be of great help!
Thanks in advance.Doing an explain plan will parse the statement prior to calculating the plan. Eg:
SQL> explain plan for select * dual;
explain plan for select * dual
ERROR at line 1:
ORA-00923: FROM keyword not found where expectedEven easier if you use Toad or some other GUI front end where the explain plan is a click of a button (or a keyboard shortcut) away! -
How to set client within SQL statement without using another pl/sql stmt.
I have a following select statement
SELECT SUM (w.prior_forecasted_costs + w.prior_committed_costs)
FROM xxsuf.job_cost_summary_table w,
apps.pa_periods p,
pa.pa_resources bz,
pa.pa_resource_list_members cz,
pa.pa_tasks dz
WHERE w.project_id = z.project_id
AND w.task_id = dz.task_id
AND dz.task_number '98000'
AND w.resource_list_member_id = cz.resource_list_member_id
AND cz.resource_id = bz.resource_id
AND NOT EXISTS (SELECT NULL
FROM pa.pa_tasks zz
WHERE zz.parent_task_id = dz.task_id)
AND w.resource_list_member_id != 1000
AND p.period_name = w.pa_period
AND p.current_pa_period_flag = 'Y'
Above select statement uses pa_periods view which only works when I set my client using "exec DBMS_Application_Info.set_client_info(83);" in Toad or SQL*Plus session.
I was wondering how can I achieve it within select statement. so that I don't have to use another PL/SQL statement to set my client. Is there anyway to set client with my org id within above select statement ?
Please advise.
--RakeshYou can simply create a function which calls dbms_application_info and use that in your sql statement as in
SQL> create or replace function set_client_info (i_info varchar2)
return varchar2
as
begin
dbms_application_info.set_client_info (i_info);
return i_info;
end set_client_info;
Function created.
SQL> create or replace view v_emp
as
select * from emp where empno = to_number(sys_context('userenv','client_info'))
View created.
SQL> select ename from v_emp where set_client_info(7788) is not null
ENAME
SCOTT
1 row selected.
SQL> select ename from v_emp where set_client_info(7900) is not null
ENAME
JAMES
1 row selected. -
PL/SQL Entity Object - Accessing Out parameter values in insertRow method
Hi,
I have the following pl/sql code which takes 4 input parameter and 1 out parameter.
create or replace procedure xxfwk_emp_create(p_person_id IN NUMBER, p_first_name IN VARCHAR2, p_last_name IN VARCHAR2, p_sal IN NUMBER) is
cursor c1 is select EMPLOYEE_ID from fwk_tbx_employees;
v_status varchar2(1) := 's';
BEGIN
for v_c1 in c1 loop
if v_c1.employee_id = p_person_id then
p_error_msg:= 'Person with this id already exist';
v_status := 'e';
end if;
exit when c1%notfound OR v_status='e' ;
end loop;
if v_status = 'e' then
goto error;
end if;
INSERT INTO FWK_TBX_EMPLOYEES(EMPLOYEE_ID,
FIRST_NAME,
LAST_NAME,
FULL_NAME,
SALARY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_LOGIN)
VALUES(p_person_id,
p_first_name,
p_last_name,
P_first_name||' '||p_last_name,
p_sal,
sysdate,
fnd_global.user_id,
sysdate,
fnd_global.user_id,
fnd_global.login_id);
<<error>>
null;
END xxfwk_emp_create;
I have following code in EO Impl class
public void insertRow()
try
OADBTransactionImpl oadbTrans = (OADBTransactionImpl)getDBTransaction();
String s = "begin xxfwk_emp_create(p_person_id=>:1, p_first_name=>:2, p_last_name=>:3, p_sal=>:4, p_error_msg=>:5);end;";
OracleCallableStatement oraCall = (OracleCallableStatement)oadbTrans.createCallableStatement(s,-1);
oraCall.setNUMBER(1,getEmployeeId());
oraCall.setString(2,getFirstName());
oraCall.setString(3,getLastName());
oraCall.setNUMBER(4,getSalary());
*< How to access Out Parameter from The procedure >*
oraCall.execute();
catch(SQLException sqlException)
throw OAException.wrapperException(sqlException);
catch(Exception exception)
throw OAException.wrapperException(exception);
In this insertRow i want to get the error message (out param) and throw this message as exception in OA page.
What changes i need to do in my page?
Regards,
RamThanks sumit..
I changed the code as below still i am not getting the error message on the page.
In jdeveloper i am successfully printing the error message.
here is the code..
try
OADBTransactionImpl oadbTrans = (OADBTransactionImpl)getDBTransaction();
String s = "begin xxfwk_emp_create(p_person_id=>:1, p_first_name=>:2, p_last_name=>:3, p_sal=>:4, p_error_msg=>:5);end;";
OracleCallableStatement oraCall = (OracleCallableStatement)oadbTrans.createCallableStatement(s,-1);
oraCall.setNUMBER(1,getEmployeeId());
oraCall.setString(2,getFirstName());
oraCall.setString(3,getLastName());
oraCall.setNUMBER(4,getSalary());
String p_error_msg = null;
System.out.println("Error message before call "+p_error_msg);
Types OracleTypes;
oraCall.registerOutParameter(5,OracleTypes.VARCHAR);
if (p_error_msg!=null)
throw new OAException(p_error_msg,OAException.ERROR);
oraCall.execute();
p_error_msg = oraCall.getString(5);
System.out.println("Error message after call "+p_error_msg);
catch(SQLException sqlException)
throw OAException.wrapperException(sqlException);
catch(Exception exception)
throw OAException.wrapperException(exception);
Regards,
Ram -
SQL statement for query of all values
I am trying to pull all the EE's that do not have a value in a specific fields for any row in history.
Example
Employee table
Each employee can have 5-10 rows each
The field employeeX can be either Y or N
I only want to pull the distinct employee's name that have N for every single row.Here's one way:
DECLARE @employees TABLE (employeeID INT, currentlyEmployed CHAR(1), updateDateTime DATETIME)
INSERT INTO @employees (employeeID, currentlyEmployed, updateDateTime)
VALUES
(1, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(1, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(1, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(1, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(1, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(2, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(3, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(3, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(3, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(3, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(3, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(4, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(4, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(5, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(5, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(5, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(5, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(5, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(6, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(6, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(6, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(6, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(7, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(8, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(8, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(8, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(9, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),(10, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP)),
(10, CASE WHEN ROUND(((2 - 0 - 1)*rand())+1,0) = 1 THEN 'Y' ELSE 'N' END, DATEADD(DAY,ROUND(((30 - 1 - 1)*rand())+1,0),CURRENT_TIMESTAMP))
SELECT *
FROM @employees e
LEFT OUTER JOIN (SELECT employeeID FROM @employees WHERE currentlyEmployed = 'Y' GROUP BY employeeID) e2
ON e.employeeID = e2.employeeID
WHERE e2.employeeID IS null
In future please provide at least example data, if not DML and DML as well. -
How to Retrieve SQL Statements in RDF Reports
I need to retrieve the SQL statements from my reports without having to call each of them up in Reports Builder. The reports are in binary (RDF format). Does anyone know of a way to do this?
Hello,
Convert your RDF into a text format :
- REX
- XML/HTML/JSP if your are using Reports 9.0.x or greater)
and search in these text files .
Regards -
BusinessObject 4.0 API to get SQL statement from webi or crystal report
Hello,
Need your help.... could you confirm whether BusinessObjects 4.0 provides any SDK, API or Web Service to get physical SQL statement from the webi or crystal reports file?
If so, could you provide name of package, class and method?
If I am not wrong, there is an SDK in v3.0 that allows to extract the SQL. But I am reading a lot on these forums that lot of SDK classes and functions are deprecated / removed in v4.0.
Thanks for your help.
OmerFor Crystal Reports in BI 4.0 to retrieve the SQL query you can use Report Application Server SDK. Here is a code snippet that retrieves the SQL statement.
//oInfoObjectReport is of type IInfoObject corresponding to the crystal report.
ReportClientDocument reportClientDoc = reportAppFactory.openDocument(oInfoObjectReport, 0, Locale.ENGLISH);
//for all crystal reports
GroupPath grpPath = new GroupPath();
//get CR SQL query string
String reportSQL=reportClientDoc.getRowsetController().getSQLStatement(grpPath,null);
System.out.println("report SQL String: "+reportSQL);
//for report whose datasource is command object:
Tables tables = reportClientDoc.getDatabaseController().getDatabase().getTables();
for (int i = 0; i < tables.size(); i++)
ITable table = tables.getTable(i);
ICommandTable ic= (ICommandTable) table;
//Command can be obtained from the report using getCommandObject() method
//get CR SQL query string
String SQLText=ic.getCommandText();
System.out.println("SQLText_"+i+": "+SQLText);
Here are useful links for BI 4.0
[RAS API Specification|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_apiRef_en.zip]
[RAS Developer Guide|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_dg_en.zip] -
Can someone help me correct this sql statement in a jsp page?
ive been getting the java.sql.SQLException: Incorrect syntax error for one of my sql nested statements. i cant seem to find similar egs online, so reckon if anyone here could help, really appreciate it.
as im putting the nested sql in jsp page, it has to be with lots of " " n crap. very confusing if there are nested.
heres the sql statement without those "" that i want to use:
select top 5 * from(
select top+"'"+offset+"'"+" * from prod where cat=" +"'" cat "'"+"
)order by prodID desc
when i put this in my jsp pg, i had to add "" to become:
String sql = "select top 5 * from("+"select top"+"'"+offset+"'"+" * from prod where cat=" +"'" +cat+ "'"+")order by prodID desc";cat=" +"'" cat "'"+")order by prodID desc";
all those "" are confusing me to no end, so i cant figure out what should be the correct syntax. the error says the syntax error is near the offset.If offset is, say, 10, and cat is, say, "new", then it looks like you're going to produce the SQL:
select top 5 * from(
select top '10' * from prod where cat='new'
)order by prodID descThat looks exactly like incorrect syntax to me... top almost certainly can't handle a string literal as its operand... you almost certainly would want "top 10" instead of "top '10'"...
If you use PreparedStatement, you don't have to remember what you quote and what you don't and you can have your SQL in a single static final string to boot... -
Multiple Executions Plans for the same SQL statement
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.
Below is the awrsqrpt's output for your reference.
WORKLOAD REPOSITORY SQL Report
Snapshot Period Summary
DB Name DB Id Instance Inst Num Release RAC Host
TESTDB 2157605839 TESTDB1 1 10.2.0.3.0 YES testhost1
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 32541 11-Oct-08 21:00:13 248 141.1
End Snap: 32542 11-Oct-08 21:15:06 245 143.4
Elapsed: 14.88 (mins)
DB Time: 12.18 (mins)
SQL Summary DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
Elapsed
SQL Id Time (ms)
51szt7b736bmg 25,131
Module: SQL*Plus
UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
TEST_BATCH_DT = (:B1 )
SQL ID: 51szt7b736bmg DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> 1st Capture and Last Capture Snap IDs
refer to Snapshot IDs witin the snapshot range
-> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
Plan Hash Total Elapsed 1st Capture Last Capture
# Value Time(ms) Executions Snap ID Snap ID
1 2960830398 25,131 1 32542 32542
2 3834848140 0 0 32542 32542
Plan 1(PHV: 2960830398)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 25,131 25,130.7 3.4
CPU Time (ms) 23,270 23,270.2 3.9
Executions 1 N/A N/A
Buffer Gets 2,626,166 2,626,166.0 14.6
Disk Reads 305 305.0 0.3
Parse Calls 1 1.0 0.0
Rows 371,735 371,735.0 N/A
User I/O Wait Time (ms) 564 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 1110 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS FULL | TEST | 116K| 2740K| 1110 (2)| 00:00:14 |
| 3 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 5 (0)| 00:00:01 |
| 4 | INDEX RANGE SCAN | ACCT_DT_ACC_IDX | 1 | | 4 (0)| 00:00:01 |
Plan 2(PHV: 3834848140)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 0 N/A 0.0
CPU Time (ms) 0 N/A 0.0
Executions 0 N/A N/A
Buffer Gets 0 N/A 0.0
Disk Reads 0 N/A 0.0
Parse Calls 0 N/A 0.0
Rows 0 N/A N/A
User I/O Wait Time (ms) 0 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 2 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 28 | 2 (0)| 00:00:01 |
| 3 | INDEX RANGE SCAN | TEST_DT_IND | 1 | | 1 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 4 (0)| 00:00:01 |
| 5 | INDEX RANGE SCAN | INDX_ACCT_DT | 1 | | 3 (0)| 00:00:01 |
Full SQL Text
SQL ID SQL Text
51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )Your input is highly appreciated.
Thanks for taking your time in answering my question.
RegardsOracle Lover3 wrote:
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.If you're using bind variables and you've histograms on your columns which can be created by default in 10g due to the "SIZE AUTO" default "method_opt" parameter of DBMS_STATS.GATHER__STATS it is quite normal that you get different execution plans for the same SQL statement. Depending on the values passed when the statement is hard parsed (this feature is called "bind variable peeking" and enabled by default since 9i) an execution plan is determined and re-used for all further executions of the same "shared" SQL statement.
If now your statement ages out of the shared pool or is invalidated due to some DDL or statistics gathering activity it will be re-parsed and again the values passed in that particular moment will determine the execution plan. If you have skewed data distribution and a histogram in place that reflects that skewness you might get different execution plans depending on the actual values used.
Since this "flip-flop" behaviour can sometimes be counter-productive if you're unlucky and the values used to hard parse the statement leading to a plan that is unsuitable for the majority of values used afterwards, 11g introduced the "adaptive" cursor sharing that attempts to detect such a situation and can automatically re-evaluate the execution plan of the statement.
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/ -
How to create formulas in an SQL statement
Hello,
I am trying to create a formula in an sql statement without creating a external function.
Here is my example :
select (x + y) as a,
(x + y) + 2
from dual
As you can see the formula “(X + Y)” is repeated.
I would be glad to write a select statement like that :
select (x + y) as a,
a + 2
from dual
any ideas?
ThanksI have a nasty feeling there is in XQuery expressions, but I'm not going there. ;-)
michaels> WITH t AS
(SELECT 1 ID, 1 x, 2 y FROM DUAL UNION ALL
SELECT 2, 3, 4 FROM DUAL UNION ALL
SELECT 3, 5, 6 FROM DUAL)
SELECT *
FROM XMLTable('declare function local:a($a,$b)
($a + $b)
}; (: eof :)
for $i in /ROWSET/ROW
return <ROW>
<ID>{$i/ID}</ID>
<X>{$i/X}</X>
<Y>{$i/Y}</Y>
<A>{local:a($i/X,$i/Y)}</A>
<B>{local:a($i/X,$i/Y) + 2}</B>
</ROW>' PASSING XMLTYPE(CURSOR(SELECT * FROM t))
COLUMNS ID NUMBER PATH 'ID',
X NUMBER PATH 'X',
Y NUMBER PATH 'Y',
A NUMBER PATH 'A',
B NUMBER PATH 'B'
ID X Y A B
1 1 2 3 5
2 3 4 7 9
3 5 6 11 13 -
Popluating Unique data with a SQL Statement
I have a table with millions of rows.Now i have to populate the
data from that table into another table with the same
structure,but with primary key defined on two columns. In the
process of populating,data loss should not take place.
How can this be achieved with a single SQL statement without
effectin performance?
Thanx in advance ...If you are sure that there a no violations of the new primary
key, then something like
INSERT INTO new nologging
SELECT * from old
will work. If you think there may be violations of the new
primary key, then disable the primary key before doing the
insert. After the insert completes
ALTER table new
ENABLE CONSTRAINT pk
EXCEPTIONS INTO exptable
You will need to use utlexcpt.sql to create the exceptions table.
The primary key will not enable, but the exceptions table will
hold rowids of the rows that violate the key. You can use this
to fix them. -
Java.beans.Statement & java.sql.Statement
My old code from jdk1.3.1 throws the ambiguous class thingie-mo-bob. Why did they implement the new java.beans.Statement, and is there anyway to make it default to the old java.sql.Statement without having to go through all the old code and add import java.sql.Statement. I have like 200 jsp files 'n it will take a loooong time!
PeteThere r two ways to do this.
(i) One is Implement the java.sql.Statement
like
package java.beans;
public interface Statement implements
java.sql.Statement {
}What? Are you suggesting he edit the source code for java.beans.Statement and make it implement java.sql.Statement?? I would most certainly not suggest that solution- beside violating the licensing agreement, it has troubling consequences since you are basically redefining the structure of a class in a way that makes no functional sense- that is, there is no reason for java.beans.Statement to implement methods like getConnection() and the other signatures of java.sql.Statement.
I'm not sure if I'm reading your response correctly or not, but I would definitely not refactor java.beans.Statement just to get this problem solved with out editing files ... ... since java.sql.Statement is used so widely, perhaps they should have considered a different name for java.beans.Statement , although you hate to base a name off of what's going to cause the least problems, rather then what makes the most sense ... ... any way, I guess it doesn't matter now: the name has been selected .... I'd be interested to hear how you solved the problem. -
Getting SQL statement from OCIStmt
Is there a way to retrieve the SQL statement from OCIStmt structure? That is, does anyone know what this structure is? For example, if used OCIPrepareStmt, then bound all the variables to OCIStmt, can I tell from OCIStmt what the final SQL statement is? What about the statement string that was originally passed to OCIPrepareStmt()?
Thanks!
IgorHey! Thanks for your time!
use preparedStatements.I'm trying that
Then use a wrapper class called
[url=http://www.javaworld.com/javaworld/jw-01-2002/jw-0
25-overpower.html]debuggableStatement. You willget the SQL that the driver is using.
Is that only for Debugging or can i use that in live code?
Thanks again,
Ryan -
Hi All,
Please let me know how to retrieve the SQL statement from ST05 output or how to know what is the field
browsed and what was the input in SE16 from ST05.
Thank you.
With Regards,
Gandhi SubramaniHi,
Go to ST05.
(1)- Activate Trace.
(2)- Run the desired T-Code for which you want to do the SQl Trace.
(3)- Go to "ST05" and deactivate Trace.
(4)- Then Press Display Trace.
(5)- Then POP will come. Just press Execute.
(6)- Your SQL trace will be displayed, with the table names and the Field names and the logic which is retevering data from specific table.
Thanks
Saurabh
Maybe you are looking for
-
Kelby's wish list for LR4 ...
Scott Kelby posted his wish list for LRv4 on his blog today pointing out features, adjustments and tweaks he would like to see in the next iteration of Lightroom .... http://www.scottkelby.com/blog/2010/archives/11824 Is he on target? Are his suggest
-
Debugging AS91(problem)
hi freinds .. i had been assign a task for which i have to do debug, i have to do debug , In t.code AS91 for one asset class i enter some values and goes for TAKE OVER VALUES iam unable to enter the cumilited acquistion values or change these fields
-
How to catch the New-page in a report ?
Hi , I would like to know how the following can be done. While printing a report,how can we identify the beginning of a new page so that we can put the header on start of every new page ? Thanks, Sandip.
-
Webservice to Proxy scenario..
Hi, My scenario is EP -- XI -- Proxy scenario in which i have an wsdl at the EP side and what else configuration to be done for creating the proxy at the target side.. Do we need to create the inbound proxy w.r.t to the interface and request you to p
-
Does anyone have done : Idoc to MSAccess scenario
Hi, Could anyone give the step by step solution for the IDOC to MSAccess scenario.....I am unanable to build the receiver structure for MATMAS05 Idoc;. Please give the links or any type of information so that I can complete the scenario... T