Order of execution of SQL statements
Hello
I have two SQL statements where the first statement executes on a table with more than 40 million lines, the second statement is running on a table more 6 million lines. When they are running their own each take about 0.15 seconds to run, but when combined they take 20 minutes to run, (the second SQL statement is inserted in the WHERE clause of the statement of first). It would seem that after combining these statements, the first statement goes through all 40 million lines before it performs the SELECT in the WHERE clause. I think that what is necessary is to ensure the SELECT in the WHERE clause is executed first... or something like that! Anyone has any ideas on how to combine these statements but not suffer from the performance impact?
The first statement is:
Select csi.instance_id,
OEL.ordered_item
of apps.csi_item_instances csi,.
Apps.oe_order_lines_all oel
where csi.instance_id in
(1718000,3698000,48740202)
and csi.last_oe_order_line_id = oel.line_id;
The second statement is:
Select / * + INDEX (IEA (attribute_id)) * /.
IEA.instance_id
apps.csi_iea_values do
where iea.attribute_id = 10004
and iea.attribute_value is not null;
The joint return is:
Select csi.instance_id,
OEL.ordered_item
of apps.csi_item_instances csi,.
Apps.oe_order_lines_all oel
where csi.instance_id in
(select / * + INDEX (IEA (attribute_id)) * /)
IEA.instance_id
apps.csi_iea_values do
where iea.attribute_id = 10004
and iea.attribute_value is not null)
and csi.last_oe_order_line_id = oel.line_id;
Thanks for any help,
Mike
Your subquery returns probably just two values that you did originally as constants - but the optimizer thinks that you're going to get 564 K lines. This is why the indicator for the simple query has a beneficial effect, it forces the Oracle to use an index when it would otherwise make a search.
When the subquery is incorporated, however, the optimizer uses its cardinality expected to decide whether to use a nested loop join or the hash join to CSI_ITEM_INSTANCES, since the large enough estimate, he uses the hash with a join analysis complete. That's why I pointed out that the fact to tell the optimizer to how many lines outside the subquery should make a difference.
Have you tried the "common table expression" approach, rather than approach no_merge, but it would not help because it does not change the optimizer for cardinality estimate. If you want to repeat the method CTE adding boards / * + materialize cardinality (2) * / to the query in the WITH clause, you should get the desired result.
Concerning
Jonathan Lewis
Tags: Database
Similar Questions
-
Time of execution of SQL statements
Is there a way to see the time of the last sql instructions? (as the TOAD request viewer)
Without having to execute the statement as a script and use "set timing on."
Kind regards
Carsten
We show the run down by the exit time
You can also see the query execution times in the historical Panel SQL
-
PRE-ORDER by in the sql statement
Hello
I have a question. I'm running a quary sql to see some data.i data to be pre ordered... means that I will not use an order by clause, the result of this quary will be pre ordered. is it possible to do it in oracle 10g. If possible please show then the procedureCan be ordered by name , but it is not possible that, without any command, the data display can be ordered. Oracle said that without using an explicit order by clause , there is NO way you can get the sorted data.
Aman...
PS: Please indicate your version of db 4 digits and o/s with wires as the answers can vary depending on the version.
-
Y at - it a State chart type or the flowchart describing the order of execution process model?
One of my clients asked me this question...
I have a problem with a change in the order of execution in TestStand 4.1.1. [he has improved from 3.1 to 4.1.1] It seems that ProcessModelPreStep runs earlier in 4.1.1 to 3.1. This causes our model of error because some required variables have not been set when executing. I wish that was a big flow chart or a diagram of the State for TestStand. Maybe it is and I don't know where to look?
The reminder that you describe is a reminder of engine and is independent of the process template. There is a list of all actions and their order described in the TestStand reference manual in Chapter 3 of the section called "step Execution. You will see the action 11 is a reminder of previous step motor.
P. Allen
NEITHER
-
Several SQL statements with zero executions in the region of SQL
Hello
one of my databases has a large number of statements in the SQL box with zero executions. Some of them analyzed several times without a single run. Why the database stores these statements and how to avoid or reduce them?
My problem is that the only time or zero time sql statements take the largest part of the area of sql:
-sql statement and only once and without executing sql statements
Select
Count (1) num_sql_total,.
sum (decode (executions, 1, 1, 0)) num_one_use_sql,.
sum (decode (executions, 0, 1, 0)) num_no_use_sql,.
Sum (RUNTIME_MEM) / 1024/1024 mb_used,.
sum (decode (executions, sharable_mem, 1, 0)) / 1024/1024 mb_for_one_use_sql,.
sum (decode (executions, 0, sharable_mem, 0)) / 1024/1024 mb_for_no_use_sql
Of
GV$ sqlarea
where
RUNTIME_MEM > 0;
NUM_SQL_TOTAL NUM_ONE_USE_SQL NUM_NO_USE_SQL MB_USED MB_FOR_ONE_USE_SQL MB_FOR_NO_USE_SQL 23318
8739
8027
1420,95619106293
381,41183757782
530,999855041504
Concerning
Thomas
This is not unusual. Another app could analyze for example hard the most often used SQLs in upstairs app - making benefit of further processing (in theory) of sweet analysis when you use these SQLs.
In fact, I remember reading something to this effect as a performance for some factor or another Oracle document or note?
So unless you have serious questions of shared pool, why bother with these sliders? What would be the problem?
-
The format of a modifiable from the execution of SQL time SQL statement...
The format of a change of the duration of execution of a SQL statement SQL statement?
Thanks in advanceHello
If you send two even SQL query with different format then everyone will make the analysis difficult. The execution path may still remain.
Concerning
-
Plans of multiple executions for the same SQL statement
Dear experts,
awrsqrpt. SQL shows several plans for a single SQL statement executions. How is it possible that a single SQL statement will be several Plans of executions within the AWR report.
Here is the output of the awrsqrpt for your reference.
Your contribution is very much appreciated.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 )
Thank you for taking your time to answer my question.
ConcerningOracle Lover3 wrote:
How will I know (from Plan 1 and Plan 2) whose execution plan chose for the current run?Since you're already on 10.2, you can identify the actual execution plan by checking in V$ SESSION SQL_ID and SQL_CHILD_NUMBER column. This can be used to identify the plan in V$ SQL_PLAN (columns SQL_ID and CHILD_NUMBER) and in 10g, you can use the convenient DBMS_XPLAN. Function DISPLAY_CURSOR for the information of the real plan using these two parameters.
Kind regards
RandolfOracle related blog stuff:
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/ -
Order of execution in a composite application and double ampersand
Hello
I had a doubt as to the order of execution of a compound query. As a general rule, I read his right to the left, up and down.
I understand that once the value has been substituted to the variable must be explicitly undefined and all queries are working well.
I'm confused by running the example below.
1. when I run this example below that I've been invited twice .
I guess once the results and which is assigned a value & & who should himself search for new value
Select the function
employees join jobs (job_id) using
where employee_id = & who
Union
Select the function
of job_history join jobs (job_id) using
where employee_id = & & who;
2. here in the example below, the value is currently not invited only once .
. Is the lowest first executed query and if so why? Is there a special case in which this happens?
Select the function
employees join jobs (job_id) using
where employee_id = & & who
Union
Select the function
of job_history join jobs (job_id) using
where employee_id = & who;
the example below works fine with a prompt for value. Performs one of the *'& &' work as a single & *.
Select the function
employees join jobs (job_id) using
where employee_id = & & who
Union
Select the function
of job_history join jobs (job_id) using
where employee_id = & & who;
Help, please
Thank you
JayshreeHi, Mary,
to_learn wrote:
HelloI had a doubt as to the order of execution of a compound query. As a general rule, I read his right to the left, up and down.
Enforcement order has nothing to do with this problem.
The substitution variables are resolved by SQL * more as it analyzes your order. I think he analyzes in order as it appears in your script, or on the command line as you type. Turn on "SET CHECK" to verify this.
After SQL * more analysis of the command has completed, it passes the command (with replaced by their values for substitution variables) for the back-end, which compiles, and then only, executes the statement.I understand that once the value has been substituted to the variable must be explicitly undefined and all queries are working well.
I'm confused by running the example below.
1. when I run this example below that I've been invited twice .
I guess the results & who is assigned a value once & who should himself search for new valueIt's true.
Before you run the command, & which is not defined.Select the function
employees join jobs (job_id) using
where employee_id = & whichSince & that is not defined, SQL * Plus asks you to give a value to it.
After the analysis of this line, & who is still undefined, because you used a single &.Union
Select the function
of job_history join jobs (job_id) using
where employee_id = & &whom;Since & that is not defined, SQL * Plus asks you to give a value to it.
After the analysis of this line, & which is defined, because you used a double &. (Use the command SET to verify this.)2. here in the example below, the value is currently not invited only once .
. Is the lowest first executed query and if so why? Is there a special case in which this happens?Yes, once, before running the script, & is not defined yet.
Select the function
employees join jobs (job_id) using
where employee_id = & whoSince & that is not defined, SQL * Plus asks you to give a value to it.
After the analysis of this line, & which is defined, because you used a double &.Union
Select the function
of job_history join jobs (job_id) using
where employee_id = &whom;Since & that IS defined, SQL * Plus, do not stop and ask you to provide a value for it.
the example below works fine with a prompt for value. Performs one of the *'& ' work as a single & *.
Yes; but I don't think it's a very useful way to think about. In fact, two of them work as single & s one way or another.
Once again, & which is not defined at this stage.Select the function
employees join jobs (job_id) using
where employee_id = & whoSince & that is not defined, SQL * Plus asks you to give a value to it.
After the analysis of this line, & which is defined, because you used a double &.
Using a single & cause also stop and ask. If the variable is not set, SQL * more stops and you request a value, regardless of whether you have used a single & double or &.Union
Select the function
of job_history join jobs (job_id) using
where employee_id = & &whom;Since & that set, SQL * Plus you do not give a value for it.
Using a single & would also result in the same behavior. If the variable is already defined, SQL * Plus, do not stop and you ask a value; It uses the previously given value, regardless of if you have used a single & double or &. -
The States VS 2011 helps:
************************************
Strap of model execution
Each model run loop running a compiled template for. The number of loops execution model is determined by the number of models specified in system definition file. By iteration, the loop of each model is run performs the following tasks:
- Reads the data sent by the primary control loop and maps those data to the inputs of the model.
- Performs a single step of the model.
- Reads the values of model output and sends this data to the primary control loop.
**************************************
Suppose that:
- I have 3 models such as the output of each model is directed towards the entrance of the next model: model 1 model 2 > model 3
- with channels correspondents mapping such as:
Model1_output <---->Model2_input
Model2_output <---->Model3_input
- The order of execution is set to "parallel."
- Decimation of model is set to 1 for all three.
The three models will run within the same tick PCL "in parallel" in the context of loop PCL, while running in series in the time slot of ticks because of the way the channel map is defined?
THX.
L.
Lol stream mapping does not determine the order of execution. In parallel mode, the three models receive identical entries of the PCL. These entries are based on the previous iteration of the system. The outputs of the model of the iteration (N-1) update the PCL at the beginning of the iteration (N), and these updates are available as inputs of the model during the iteration (N).
In your case:
Check 1
Write A for model 1, model 1 run and written was ' to PCL
Tick 2
Model 2 Gets A' starting from PCL, runs and writes A "to PCL
Tick 3
Model 3 Gets A "PCL, performs and writes A" ' to PCL
If this is not desirable, you should put the standard models of the category of the order of execution under the Simulation models in System Explorer. This makes the outputs of the model available on other models in the same iteration of the PCL. Note, there is no output model available for the rest of the system until the next iteration of the PCL.
Steve K
---->----> -
With the help of a number variable in a SQL statement
Hello
I am trying to use a variable in a sql statement, and I ran into problems when the variable is a number. The following line of code works if the variable is a string, but not if it is a number.
"SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID = '" + Locals.LocalUnitID + "' ORDER BY DESC START_DATE_TIME.
Is there a difference in the use of single and double quotes and the sign for numbers variables +?
Thank you
Stuart
Jervin is almost correct in the post above.
While it is correct that numbers in SQL are not enclosed in single quotes ('), we still need the entire expression to a string. If Locals.LocalUnitID is stored as a number to TestStand, you will need to cast to a string so that the string concatination works properly.
I believe that the correct form is as follows:
"SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID ="+ Str (Locals.LocalUnitID) + 'ORDER BY DESC START_DATE_TIME'
-
Identify the SQL statements that are executed frequently
I would like to identify SQL statements that are executed may times (e.g., > 1000 times) during an interval AWR.
I am aware of coloring a SQL_ID with exec ('...') dbms_workload_repository.add_colored_sql; but then the SQL ID must be known.
Is it also possible to do the same for the (not yet known) SQL statements that are executed > 1000 times? I think that the SQL statements that run very quickly (for example 1 s <) won't be captured automatically in a CWA even if those statements are frequently performed.
Version 11.2.0.4 on SLES11
Try this...
fixed lines 155
execs from collar to 999 999 999
Col min_etime to 999,999.99
Col max_etime to 999,999.99
Col avg_etime to 999,999.999
Col avg_lio to 999,999,999.9
Col norm_stddev to 999,999.9999
Col begin_interval_time to a30
node of col to 99999
break on plan_hash_value on startup_time skip 1
Select * from)
Select sql_id, sum (execs), min (avg_etime) min_etime, max (avg_etime) max_etime stddev_etime/min (avg_etime) norm_stddev
de)
Select sql_id, execs, plan_hash_value, avg_etime,
StdDev (avg_etime) on stddev_etime (sql_id partition)
de)
Select sql_id, plan_hash_value,.
Sum (NVL(executions_delta,0)) execs,
(sum (elapsed_time_delta) /decode (sum (nvl(executions_delta,0)), 0.1, sum (executions_delta)) / 1000000) avg_etime
-sum ((buffer_gets_delta/decode (nvl(buffer_gets_delta,0), 0.1, executions_delta))) avg_lio
DBA_HIST_SQLSTAT s, DBA_HIST_SNAPSHOT SS
where ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and executions_delta > 0
Group of sql_id, plan_hash_value
)
)
Group of sql_id, stddev_etime
)
where norm_stddev > nvl (to_number('&min_stddev'), 2)
and max_etime > nvl (to_number('&min_etime'),.1)
order of norm_stddev
/
-
How to run a SQL statement to use a specific implementation plan
Hi all
I have a SQL that has recently been run badly. I tried the Advisor tuning SQL for the given SQL query and it gives the following information:
GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Name of the task of tuning: 2q94zb7djr2xn
The owner task of tuning: LMDBPROD
Type of work: single SQL statement
County of execution: 2
The current run: EXEC_8869
Type of execution: TUNE SQL
Scope: COMPLETE
Time Limit (seconds): 60
Status: COMPLETED
Started on the: 03/02/2014-20:43:39
To the: 03/02/2014 20:44:25
-------------------------------------------------------------------------------
Name of the schema: LMDBPROD
SQL ID: 2q94zb7djr2xn
SQL text: SELECT NPCOMMON. FGET_ACTION_CODE (ORDNUM) ACTIONCODE, STATUS,
SUMA COUNT (*) FROM SORDER, WHERE HEADORDNUM IS NOT NULL AND
NPCOMMON. FGET_PRODUCTOFFER4ORDER (ORDNUM) IN (SELECT ID FROM)
PRODUCTOFFER WHERE PPSPECIFICATION_ID IN (SELECT ID FROM)
PPSPECIFICATION WHERE PCLASS_CODE IN (SELECT PCLASS_CODE FROM)
ARUSERGROUP WHERE CODE IN (SELECT ARUSERGROUP_CODE FROM)
ARUSER_ARUSERGROUP WHERE ARUSER_USERNAME =: B1 AND STATUS = '1')
AND STATUS = '1'))) GROUP BY NPCOMMON. FGET_ACTION_CODE (ORDNUM),
STATUS
-------------------------------------------------------------------------------
RESULTS SECTION (1 result)
-------------------------------------------------------------------------------
1-alternative Plan conclusion
---------------------------
Some implementation plans alternative for this statement was found by searching
performance data in real-time and historical of the system.
The following table lists these plans sorted by their average time.
See "SECTION of ALTERNATIVE PLANS" section for detailed information on each
plan.
plan ID hash last visit elapsed note of origin (s)
-- ---------- -------------------- ------------ --------------- ----------------
1 617797893 2013-07-11/07: 45:20 9.555 no reproducible STS
2 1311086720 2014-01-31/04: 00:44 19.569 AWR
3 1226863820 2014-01-31/18: 00:24 AWR 21.158
4 1359606848 2014-02-03/16: 00:34 21.492 AWR original plan
The plan with hash 617797893 seems the most efficient one and is based on some specific SQL Tuning Set I ran on this time. But the note says that the plan is not reproducible. Is there anyway how can I force the SQL statement to execute the plan? The database version is Standard Edition 11.2.0.1.0
Best regards
Rodriguez
Hello
I think you can use this
before 11 g, we used to create an outline stored for this.
concerning
-
Quick question, on the execution of the query of the ff, I do
Select a.column, sum (decode(a.column,'string',1,'etc...')
But when I include a func or procedure, it won't allow me too and that he would give a PL/SQL: SQL statement ignored error and it will compile only if I remove the first a.column as follows
Select sum (decode(a.column,'string',1,'etc...')
Why is it so? And how should it be rewritten to include the select a.column?
Start
Select a.gameid, sum (decode(a.nscores,'Perfect',100,'Excellent',95,'Good',80,'Poor',50) 'scores'
in x,y
Of...
where the...
return x
end myFunc;
Fundamentals of the PL/SQL language
Concerning
Etbin
-
How to execute a SQL statement that is stored within a SQL Table
Hello
If someone please help me with the following problem I would be eternally grateful
I have a SQL statement that is stored inside a certain SQL table, I want to use this SQL statement inside my PL/SQL procedure.
Thought a simple solution was to get the SQL statement in a table, and then run it, but how could I do so exactly with PL/SQL? I only started to play with PL/SQL in the last days.
Thanks in advance!
This is what it looks like more or less:
Display result for:
---------------------
SELECT TRIM (OBJ_VALU_TXT)
OF OBJ_VALU_DOC
WHERE TYPE_OBJET = 'FLD '.
AND OBJECT_CODE = 15443
AND OBJ_VALU_CD = 'CAB '.
ORDER BYDOC_SEQ_NO
00001
------------------------------------------------------------------
SELECT
VALUE (MAX (RECEIPT_NO) + 1,: OUT-COMP-FACTOR)
THE FRONT DESK
WHERE (RECEIPT_NO BETWEEN
(: OUT-COMP-FACTOR AND: OUT TO A NUMBER) OR
(RECEIPT_NO >: OUT-COMP-FACTOR AND)
(: OUT-TO-NUMBER = 0)
Here's a demo of your condition.
create table t (col1 varchar2 (200));
table created
insert into values t ('select * from double ');
1 row inserted
declare
v_col varchar2 (200);
v_val varchar2 (200);
StartSelect col1 in t v_col;
run immediately v_col in v_val;
dbms_output.put_line (v_val);
end;-----
XUse in the clause, you can use as many variables as needed. But the basic approach remains the same.
But storage in DB SQL is not an efficient design.
Ishan
-
any body can help me to merg below of the sql statements for the information
No. 1
Select S.USERNAME, s.sid, s.osuser, t.sql_id, sql_text
de v$ sqltext_with_newlines t, V$ SESSION s
où t.Address = s.sql_address
et t.hash_value = s.sql_hash_value
et s.status = 'ACTIVE'
et s.UserName <> 'SYSTEM'
order by s.sid, t.piece
/
Statements #2
SELECT SID, to_char (start_time,'hh24:mi:ss') stime,
message, (sofar/totalwork) * 100%
DE v$ session_longops
OÙ sofar/totalwork < 1
/
I tried
Select S.USERNAME, s.sid, s.osuser, t.sql_id, sql_text, to_char (sl.start_time,'hh24:mi:ss') stime,
- SL.message, (sl.sofar/sl.totalwork)* 100%
de v$ sqltext_with_newlines t, V$ SESSION s, v$ session_longops sl
where s.sid = sl.sid
and where t.Address = s.sql_address
et t.hash_value = s.sql_hash_value
et s.status = 'ACTIVE'
et s.UserName <> 'SYSTEM'
et OÙ sl.sofar/sl.totalwork < 1
order by s.sid, t.piece
but it gives me error.
SQL > select S.USERNAME, s.sid, s.osuser, t.sql_id, sql_text, to_char(sl.start_time,'hh24:mi:ss') stime,.
2 sl.message, (sl.sofar/sl.totalwork)* 100%
3 v $ sqltext_with_newlines t, V$ SESSION s, v$ session_longops sl
4 where s.sid = sl.sid
5 and where t.address = s.sql_address
and t.hash_value = s.sql_hash_value
6 and 7 s.status = 'ACTIVE '.
8 and s.username <>'SYSTEM '.
9 and WHERE the sl.sofar/sl.totalwork < 1
10 decree by s.sid, t.piece
11.
and where t.address = s.sql_address
*
ERROR on line 5:
ORA-00936: lack of expression
any body can help out?
Not tested, but you can try:
SELECT s.sid,
s.Serial #.
s.machine,
Round (SL.elapsed_seconds/60). ':' || MOD(SL.elapsed_seconds,60) has elapsed,
Round (SL.time_remaining/60). ':' || MOD(SL.time_remaining,60) remaining.
ROUND (sl.sofar/sl.totalwork*100, 2) progress_pct.
t.sql_id,
t.sql_text
V $ session s,.
v$ session_longops sl.
v$ sqltext_with_newlines t
WHERE s.sid = sl.sid
AND s.serial # sl.serial = #.
and t.address = s.sql_address
and t.hash_value = s.sql_hash_value
and s.status = 'ACTIVE '.
and s.username <> 'SYSTEM '.
order of s.sid, t.piece;
Or see if you can find a useful script here:
Maybe you are looking for
-
Good afternoon... On pages 116-118 of the manual "how to choose the right Fax Setup... », 1] I do not have a distinctive ring [2] receive voice calls in the same phone # I'll use for fax calls [3] I have a modem from pc on the same phone line as my H
-
Hi all I have a Tecra M1, which was bought about three months ago (second hand).It had Windows Xp home installed any other software and no CD of restoration.I decided to reformat and put Xp pro, using drivers from the Toshiba site.Everything went wel
-
No Satellite A300 - 16I Conexant soundcard no hardware buffering?
Hi all I recently bought a Satellite A300-16I (PSAJ4E). I downgraded from Windows Vista to Windows XP Pro and installed all the drivers from the site Web of Toshiba driver for Win XP for this model. Everything works fine, except the Conexant High Def
-
How the PFI to go top-to-bottom with sample clock?
Hello world! I am very new to LabView and I try to do something very simple in the NI PCI-6534 and still not get anywhere (or do not know if it is the limitation of the hardware) My request is to acquire digital data of 2 channels (16-bit each) of ou
-
I already asked this before and received an answer and it worked, I have a Philips PCVC740K from the work of micro webcam camera where can I go to download driver which is safe