Oracle In Loop Evaluation

Sep 25, 2012

I have an assignment to check the consistency of Oracle database for different conditions.I am having some 200+ columns i a table i need to populate data using prepare statement in .net and check the conditions how it works for each loop values.I am having loop values starting from 1,5,50,100.... 10000k i will increment the loop value as 1,5,50,100.... 10000k and need to get the start time and end time of each loop, i need to check the consistency of the database.

Value for the loop(1,5,50,100.... 10000k) will be from a xml file or text file
For the 200+ Columns i am having 2PK's.

CONDIDTIONS

1)Whether i need to restart for every loop value say if i run loop value as 1 then i need to restart the system (not the services) and run for loop value 5 and restart and so on.
2)Whether i need to restart for every loop value say if i run loop value as 1 then i need to restart the services and run for loop value 5 and restart services and so on.
3)Whether i can continue my loop value starting from 1,5...10000k without restart or any other process continuously running starting from 1...10000k in single go

why i am asking this is whether Oracle will act as differently when i do the above process and will there be any performance improvement or performance variations from the above steps if i followed. Whether there be same value for all the three steps or will there be variation in from time and end time for each conditions.

I need to check for insertion time(time difference b/w from time and then loop condition and then end time) for each loop.

View 18 Replies


ADVERTISEMENT

Performance Tuning :: AWR Report Evaluation

May 20, 2010

My DB is oracle10g.

I have AWR report comparison for two different days. I want to find the below things.

1. Which day has better performance?
2. What are the top two findings on the report.

I attached the report.

Here are my answer. Please correct me if i am wrong.

1. Which day has better performance? Second day has higher load. Since redosize is showing very high.
2. What are the top two findings on the report.

a) Compared to two days, first day, little bit more I/0 wait for single block read.
b) Compared to two days, 2nd day, it takes higher CPU.

However, which day is best compared to two days?

View 5 Replies View Related

PL/SQL :: Bind Variables And Expression Evaluation

Aug 29, 2013

i have been looking at a query that uses a wrong plan. db=11.2.0.3 with user bind peeking enabled. this is a simplified version demonstrating the problem: 

select egp.bsn,egp.klantnummer as "Persoonsnummer", egp.samengesteldenaam as "Samengesteldenaam", egp.geboortedatum as "Geboortedatum"from   pr_eigenschappen2      egpwhere(egp.bsn = :b1 or :b2 is null)and rownum < 51 egp.bsn is varchar2(10) and has high selectivity (almost unique), and is btree-indexed. table and index have adequate statistics. when run with b1:=928818 and b2:=928818  (both bound as varchar2(10)) a full table scan+filter is used on pr_eigenschappen2. if the query is changed to select egp.bsn,egp.klantnummer  as "Persoons nummer", egp.samengesteldenaam as "Samengesteldenaam", egp.geboortedatum as "Geboortedatum"from   pr_eigenschappen2      egpwhere(egp.bsn   = :b1 or 928818 is null)

and rownum < 51the index on bsn is used, and the query is not taking 3.9 seconds but 1 millisecond.if i would have a choice, the query would be different. i don't want to talk about the raison d'etre of the query, i would like to know why the optimizer is not using the index in the first case.

View 23 Replies View Related

PL/SQL :: Analytic Function Evaluation Order?

Sep 30, 2013

ihave query quite like this: with--

This query selects one

"representant" acct_id per group (about 300 rows total)acct_repres as(  select distinct acct_id, origin_id,  acct_parm_id from  (  select a.*  ,  source_id  , dense_rank() over (partition by source_id origin_id order by acct_nbr nulls first, acct_id) as odr    from account a join account_parm  ap on (a.parm_id = ap.acct_parm_id)  )  where odr = 1)select col1    , col2     , ( select accct_id from acct_repres ar where ar.acct_parm_id = t2.acct_parm_id) col3    , ( select count(1) from acct_repres) col4from some_table t1join other_table t2 on (....) 

And here it comes.

The "acct_repres" subquery returns more than 300 rows when executed separately. But when used in CTE sometimes (depending on execution plan) it seems to have only one row - the value in the column col4 is "1",while value for col3 is NULL for most of the cases. It looks like the the dense_rank function and the condition "where odr =1" are evaluated at the very end.

When I use MATERIALIZE hint the result was the same. But when I put the result of account_repres into dedicated table and use that table instead of CTE the output is correct.

View 6 Replies View Related

Forms :: Dynamic IF Condition Evaluation In 9i Environment

Apr 6, 2005

I'm using forms 9i. Let's say I have a Block in the form B1. It has two items I1 and I2. I have a table called T1 that has a column say C1. The data in the only record in T1 is 'NAME_IN(''B1.I1'') = 1 OR NAME_IN(''B1.I2'') = 2'..In forms I need to execute the following at POST-QUERY trigger of the block:-

DECLARE
VAR1 VARCHAR2(1000);
BEGIN
SELECT C1
INTO VAR1
FROM T1;
[code]....

As you could see that the IF statement is wrong. But I get the condition (for IF condition) as a string value from some database table.

View 9 Replies View Related

Windows :: Setup ODT With ODAC121010 On Server 2012 Standard Evaluation 64-bit?

Oct 8, 2013

I have one problem when i try to setup ODTwithODAC121010 for connect from Visual Studio 2012 express to Oracle database 10g R2.When i setup ODTwithODAC121010 on Windows 7, can connect from visual studio to oracle database, but when i setup on Windows server 2012 Standard Evaluation x64 can't connect to oracle database through Visual studio 2012 express.

I check in registry of windows server 2012 x64 can't show Oracle folder in registry.how to connect from Visual studio 2012 express on windows server 2012 Standard evaluation x64 to Oracle database 10g.

View 3 Replies View Related

VPD Function With Loop - Oracle 11g

Jul 5, 2012

I have the following function:

CREATE OR REPLACE FUNCTION get_project_id(
schema_p IN VARCHAR2,
table_p IN VARCHAR2)
RETURN VARCHAR2
IS
projects_pred VARCHAR2 (400);
[code].......

I am trying to get the projects a user has from the works_on table (user_id, project_id). The user_id is retrieved from the context projects_ctx. I am getting the error Function created with compilations errors.

View 6 Replies View Related

PL/SQL :: Possible To Use Forall Instead Of For Loop - End Loop

Nov 19, 2012

CREATE OR REPLACE PROCEDURE IND_MONITOR(P_tab VARCHAR2)
is
type ind_table is table of varchar2(20);
p_ind ind_table;
v_sql varchar2(2000);
begin
select index_name bulk collect into P_Ind from user_indexes where table_name=upper(P_tab);
for i in 1..p_ind.count loop
v_sql :='alter index '||p_ind(i)|| ' monitoring usage'
execute immediate v_sql using p_ind(i);
end loop;
end;

can i use forall instead of 'for loop ..end loop'

View 10 Replies View Related

Performance Tuning :: How Oracle Optimizer Choose Joins (hash / Merge And Nested Loop Join)

Oct 18, 2012

I want to know how the Oracle optimizer choose joins and apply them while executing the query. So that I will insure about optimizer join before writing any query.

View 2 Replies View Related

SQL & PL/SQL :: Best Way To Loop Against CSV

May 25, 2010

I have a list of strings ( like a,b ,c) that I want to loop againts. I will be creating string to execute them as dynamic sql.I could have put the string in a table and loop againt the table but this is a deployment script so I do not want to create any table.I can also do

DECLARE
cursor c is SELECT 'a' FROM dual UNION SELECT 'b' FROM dual ;
BEGIN
for i in c
loop
.......
end loop.
END;

But I have many strings to loop over. What is the best way to achieve it. Can i use collection to achieve this?

View 4 Replies View Related

SQL Concatenate Using A Loop

Feb 17, 2010

I have a table which I will call 'fruit basket' which contains the following data:

basket_ref, fruit, fruit_serial
1, apple, 1
1, banana, 2
1, pear, 3
2, apple, 1
2, lemon, 2

What I want to produce is a table in the following format

basket_ref, all_fruit
1, apple banana pear
2, apple lemon

There could theoretically be any amount of fruit in a given basket, so I will need to set up some kind of loop in order to read each record from the original table. I am not sure how it would be best to do this.

View 2 Replies View Related

SQL & PL/SQL :: Going To Next Record In Loop

May 25, 2011

I have a cursor which I am opening and then looping through. Within this loop I am comparing attributes within this cursor with attributes from another loop that this one is within.

you will see in the IF statements (there are several distinct IF statements within the loop) that there is a check which assesses if the attributes are not equal.

If they are NOT, the value of v_mismatch is set to 1

What I need to do instead of setting this to 1, is to go to the next record in the loop. How can I achieve this?

OPEN c_distMatrix;
LOOP
FETCH c_distMatrix INTO r_dist;
EXIT
WHEN c_distMatrix%NOTFOUND;
--compare each field and update the counter
[code].....

View 5 Replies View Related

SQL & PL/SQL :: How Does Loop Works

Jun 27, 2011

[CODE]
DECLARE
D1 DATE:='&D1';
D2 DATE;
BEGIN
WHILE D1<=D2 LOOP
DBMS_OUTPUT.PUT_LINE(TO_CHAR(D1,'DAY DD-MON-YYYY'));
D1:=D1+1;
END LOOP;
END;

Here I want to display all the seven days. One more question is here I'm d1<=d2 but d2 is null. So how does <= works here a null. A null is always null. What will be there in d2 how does the loop works with this comparision.

View 9 Replies View Related

SQL & PL/SQL :: Getting Next Data With Loop

Jun 14, 2013

This query that I pasted is working correctly.Let's say a case has 4 owners, it finds me the first owner and show me its address.

However, I want to execute this query for all owners so it should jump the previous owner it found. Lets say for that example that the loop ends at 4.
How may I fix this problem so that the loop do not return always the first owner but it keeps getting 1,2,3,4...also I should increase the sequence value for each situation

SELECT
DECODE(BREINV.NAMEKEY, NULL,'0','1') "BRE_INV",
DECODE(BREINV.NAMEKEY, NULL,' ',BREINV.SEQUENCE) "BRE_NUMINV1",
DECODE(BREINV.NAMEKEY, NULL, ' ', DECODE(BREINV.SEQUENCE,NULL,NULL,RTRIM(ADDINV.FORMATTEDADDRESS,CHR(0))||CHR(13) || CHR(10) ||'Citizen of ' ||SUBSTR(PAY.COUNTRYDESCRIPTION,1,30))) "BRE_NOMINV",
INDIVIDU.FIRSTNAME || ' ' || INV.NAME "BRE_NOMPREINV"
[code].......

View 3 Replies View Related

SQL & PL/SQL :: Lock On Loop

Aug 28, 2012

begin
for i in 1..10000 loop
update table1
set col1= col1+1
where type =1;
commit;
end loop;
end;

My question is, if a strored procedure contains the script above and the said procedure will be invoked by two or more sessions at the same time. Does it mean that the 1st session will lock the related rows and other sessions will have to wait for loop in session one to finish?

View 18 Replies View Related

SQL & PL/SQL :: Getting Error By Using NVL() And Loop

Sep 22, 2012

Declare
x number;
Begin
Loop
if NVL(x,1)>=1 then
[code].......

May be this code is going into an infinite loop. I'm unable to understand where the problem is?

View 6 Replies View Related

SQL & PL/SQL :: Cursor For Loop

Jul 30, 2012

When a cursor returns no records, how to handle this in Cursor for loop..

I had given sample code for handling this by using normal open,fetch statement, provide by applying for -Cursor For loop

DECLARE
P_BU_ID NUMBER;
P_SUMRY_DATA_TY_ID NUMBER;
P_OP_DATE VARCHAR2(32767);
P_PROC_DATE VARCHAR2(32767);
P_FIN_YEAR NUMBER;
[code]........

View 3 Replies View Related

SQL & PL/SQL :: Cursor FOR Loop?

Jun 15, 2012

I am an experienced SAS programmer jumping into PL/SQL for the first time and have already encountered a problem.Let's assume I have 7 records (shown below). (In reality, I have millions of records, but the concept's the same.) The Value field is only populated when it changes. Therefore, I am forced to "fill in the gaps" as I read the data file. It's fairly straightforward. I carry the value foward one record at a time, using it if the Value field in not populated. The ANSWER I want is also shown.

In reading through a PL/SQL book, I realized that only 2 chapters are relevant to what I do. My guess is this solution involves cursors; probably a Cursor FOR loop,

ID Year Amt ANSWER
1 2010 200 200
1 2011 ..... 200
1 2012 ..... 200
2 2009 300 300
2 2010 ..... 300
2 2011 450 450
2 2012 ..... 450

View 5 Replies View Related

PL/SQL :: Exceptions In WHILE Loop

Jul 20, 2012

I want to do something like this

-------------------------------------------------------------------------------------------------------
While Condition
LOOP
BEGIN
Insert into table1 values(......);

[Code]...

EXCEPTION
When OTHERS THEN <capture the error while inserting into an Error table>
END;
END LOOP;
-------------------------------------------------------------------------------------------------------

Now I want that If one of the insert statement within the loop fails (say table2) the exception should be captured and next insert statement (table3) should be executed.

How can I do this ? I guess I wont even need a loop

View 10 Replies View Related

PL/SQL :: LAST Record In A Loop?

Aug 27, 2012

in my loop with cursor in a procedure body i am displaying some field values to create a report and after every record i am displaying horizontal line(-------) but i don t want this line to appear after the last record displayed like below,

gfsfsf gsgfsfds gsdgfdg
------------------------------------
edyet gdgtdgt gtdfdfdgd
------------------------------------
dfds hedhgg idudhdh

how can i achieve this within pls/sql procedure body.

View 20 Replies View Related

Loop Inside Cursor

Sep 11, 2012

I have a cursor returning some value.

for each value returned by the cursor i need to traverse through 31 rows(1 row per day * no of days in the month).

E.g. if cursor returns service_name as xyz then for xyz there can be 31 rows(service may not be used on some days)

I need to go to all of them and take some values and move them to a flat file. how should that be done?

Attached File(s)
Query.png ( 20.99K )
Number of downloads: 9

View 1 Replies View Related

Loop Back Entry

Jun 1, 2013

How the loop back entry in /etc/hosts relates to listener?

View 1 Replies View Related

SQL & PL/SQL :: Update Two Table Using For Loop?

Feb 19, 2010

I want to update column in table 1 based on a substraction of two column, one from the same table and the other from different table. Then update the result of substraction in table 1. Number of rows in two tables are different.

--for r in (( select (table2.y - table1.y as x from table1, table2 where table1.x = c and table2,.x = m))
declare
i number := 1;
c number ;
m number;

[Code]....

View 8 Replies View Related

SQL & PL/SQL :: Loop Through Records Using Block?

Nov 8, 2011

How do I loop through a Input parameter (varchar_table) and pass the input value to a select query.

Procedure Test
(
param1 IN dbms_sql.varchar2_table
)

[Code]....

1. How do I define temp_tbl and is it a best practice to use temporary table - if not what is the best method to do the same.

View 5 Replies View Related

SQL & PL/SQL :: Have Multiple Variable In For Loop

Apr 5, 2010

Is it possible to have multiple variables in a for loop. For expample:

FOR i AND j in 1..10

I was wanting to increase one of the variable more than the other.

View 8 Replies View Related

SQL & PL/SQL :: Inner And Outer Loop In Cursor?

Jul 9, 2013

BEGIN
FOR i IN 1 .. 10
LOOP

[Code]....

Assume the above is my code; there is inner and outer block.

Currently if inner block is failed, the outer block also going to exception block

But, my requirement is if inner block is failed it should not go to outer block, still the loop should continue and print 1...10 rows

View 9 Replies View Related

SQL & PL/SQL :: Loop In UTL_FILE Is Not Getting Closed

Nov 1, 2013

I am trying read a File to find out the error message through UTL_FILE.m. But the loop used inside is not getting closed.

CREATE OR REPLACE procedure alert_mail_A
as
v_flag varchar2(10);
mesg varchar2(100);
c1 utl_smtp.connection; -- passing the datatype to a variable.
c varchar2 (1000);
B utl_file.file_type;
[code]........

View 1 Replies View Related

SQL & PL/SQL :: Loop Through Db_links Via Cursor

Jun 10, 2013

I am trying to retrieve info from multiple DBs and insert into a central DB via DB LINKS.The links are retrieved via a cursor.

However I keep coming up against 'PL/SQL: ORA-00942: table or view does not exist'...how to handle db_links using a cursor in a pl/sql block? The code is as follows:

DECLARE
db_link_rec VARCHAR2(30);

CURSOR db_link_cur IS
SELECT DB_LINK
from MESSAGING_PROD_LIST;
[code]....

View 3 Replies View Related

SQL & PL/SQL :: Update Table Using Loop

Apr 7, 2010

a project I'm working on. I normally work in SQL Server, so I'm a little stuck on this one.

I have a temp table (tmp_stack) with four columns:

Floor [varchar]
Unit [varchar]
Block [number]
BlockStart [number]
BlockEnd [number]

BlockStart and BlockEnd are currently NULL. What I need to do is loop through the table for each Floor and update BlockStart and BlockEnd for each Unit depending on how many blocks they use and how many have been used by prior units on that floor.

For example:

There are three units on Floor #1: 1A, 1B, and 1C.
1A = 5 blocks
1B = 3 blocks
1C = 2 blocks

For 1A, BlockStart should = 1 and BlockEnd should = 5
For 1B, BlockStart should = 6 and BlockEnd should = 8
For 1C, BlockStart should = 9 and BlockEnd should = 10

And everything should reset back to the beginning on successive floors.

In T-SQL, I would use a cursor, and I assume I need to do the same kind of thing in Oracle, but I can't figure out the syntax.

View 8 Replies View Related

SQL & PL/SQL :: Stop Loop On One Process?

Jul 3, 2010

i want check some data from one process instead of last record

i.e

process data
uuu 1
2
3
4
ppp 1
2
3
4

[code].....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved