PL/SQL :: Detect I/O Before Running Statement?
Apr 29, 2013how do I detect I/O before running sql statement?
View 3 Replieshow do I detect I/O before running sql statement?
View 3 Repliesway to run an update statement through OCI and make it stop on the first offending record and then identify that record? Here is an example of what I need to do: I run an update with 5 records in the input buffer like this:
- the 1st record exists in the table
- the 2st record exists in the table
- the 3rd record does not exist in the table
- the 4rd records exists in the table but is violating some unique constraint
- the 5nd record exists in the table
I need to report that the 4th record from the input buffer has a problem, and then commit records 1, 2 and 3. Do not commit record 5. So far I have tried the following:
- OCIStmtExecute with OCI_DEFAULT. It stops on the first error, but I don't know how to identify the bad record. OCI_ATTR_ROW_COUNT returns the number of affected records in the target table. I didn't find any other attributes that would return 4, for the 4th bad record in the input buffer.
- OCIStmtExecute with OCI_BATCH_ERROR. I can identify the bad records in the input buffer by using OCI_ATTR_DML_ROW_OFFSET. However, OCIStmt Execute does NOT stop on the first violating record. It loads the whole input buffer and then reports which records were in error. I don't know how to commit only up to the first bad record -- the 4th in the example.
with the code below i have created 2 varaibles v_start_date and v_finish_date, i have inputs for them, thats fine the problem is when the inputs are empty, i have put a ELSIF statement in the begin section of the code, now if the variables have input from the textbox's then it works fine but if they are empty, the programme reads into the if statement executes that bit of code but doesn't seem to open the cursor up and execute that bit of code.
DECLARE
v_start_date enrollments.enrollment_date%TYPE:= :START_DATE;
v_finish_date enrollments.enrollment_date%TYPE := :FINISH_DATE;
CURSOR no_grades_cur IS
SELECT class_id,stu_id, status
FROM enrollments
[code].....
I am getting ORA-00933 after running below mentioned delete statement;
DELETE FROM REPOSITORY.MEDIASEGMENT MS
INNER JOIN REPOSITORY.ROUTINGEVENT RE ON TRIM(MS.Segment_Key) = TRIM(RE.uuid)
INNER JOIN REPOSITORY.TEMPCONTACT TC ON TRIM(RE.Contact_Key) = TRIM(TC.vduid)
WHERE TC.CREATETIME BETWEEN (TO_DATE('04/24/2008 00:00:00','MM/DD/YYYY, HH24:MI:SS')) AND
(TO_DATE('04/30/2008 23:59:00','MM/DD/YYYY, HH24:MI:SS'))
After Migrating from 11.1 to 11.2 SQL Statements are running for a long time. Our DBA told that they don't have any execution plans for the SQL Statements in 11.1
I don't want to rewrite the SQl Statement as this is working fine in 11.1. Our DBA conveyed us that they are using DBMS_STATS.AUTO_SAMPLE_SIZE for Schema Level.
But we have planned to generate DBMS_STATS.GATHER_TABLE_STATS Estimate Percentage ==> 100 for only the tables that are used in SQl Statements.
Of course we can change the parameters.. But we are afraid it may have some side effects.
I ran one long running update statement in my sqlplus session, where it took hours together since we have millions of rows on the table.lock the system and left the office , the next day I found my system is rebooted, hope the session would have performed the long running update statement.
Now, I need to issue a commit for the session, since my system is rebooted I don't have opened session with me. so, How to issue commit to the session, which I have issued long running update statement.
how can i run dml statement on the oracle transparent gateway for sql server ,such as insert ,update,delete.
View 4 Replies View RelatedIs there any way i can Get how many rows are processing with UPDATE statement while the Update statement is still running.
View 2 Replies View RelatedI need to define the type of user's web-browser (Opera, Ie, chrome, firefox), under which launched forms.
View 3 Replies View RelatedI have 2 text fields as search criteria and a push button to search. When the user enter any on first field (or in any text field) and press ENTER key, I want to execute the search.
I tried the key-next-item trigger, but it's firing when I press TAB key.
How can I detect ENTER key?
I found the data in DB with negative time as below
Quote:
1 SELECT
2 c.time
3 FROM partition c
4 WHERE
5* c.time < to_date('0001-01-01','YYYY-MM-DD')
SQL> /
DEACTIVATION_TIME
------------------------------------------------------------------------
17-JUN-08 04.06.22.893 PM
The data type for c.time is Timestamp.
When I use JDBC to retrieve the data and convert it to mill seconds, and it also shows as negative time. My question is the retrieved time doesn't show the negative date, but obvious it is a BC date and earlier than 0001-01-01.
1. How can we detect/show the date to show correctly for the BC date without checking c.time < to_date('0001-01-01','YYYY-MM-DD')? (I am wondering if there is format configuration to show the time like 17-JUN-08 04.06.22.893 PM BC, or something to show the time is negative )
2.how could we fix it negative time to positive ?
Table contains duplicate data . Have to move data to another table. Criteria: check for duplicate values if duplicate exist move all duplicates except one to the history table. While moving to other table see if the record being moved already exists.
source table
SOURCE TABLE : ODS_OWNER
grp_id grp_name face_id address1 city zipcode
3456789 NIKE AERO 457899 707 CROFT GRAND RA 12345
1256789 NIKE AERO CORP 678899 707 CROFT SE GRAND RA 12345
5465455 BB SHIPPING 809708 201 SOUTH CT DESPLAINE 45434
[Code]....
FIRST 4 RECORDS ARE DUPLICATES FROM WHICH 1 RECORD GOES TO w_grp AND ONE GOES TO HISTORY TABLE. THE RECORD WHICH GOES INTO w_grp OUT OF THE DUPLICATES WILL DEPEND ON THE LAST MODIFIED DATE FOR EACH
DISTINCT VALUES GO IN w_grp TABLE
DUPLICATE GO INTO match_his TABLE
Is there a way to check which versions or oracle installed on the machine from command line?
The thing is I don't want to login to the database so I can't use SQL Plus also, till now I ran tnsping and checked the output but in case there are several versions of different platform I got only one version that was first on the path env.
Is there a way to detect bogus characters in the datafile?
SQLLoader on original file
Record 1: Rejected - Error on table DP, column STARTTIME.
ORA-01858: a non-numeric character was found where a numeric was expected
Copy the data in the controlfile using notepad++: no errors
Is it possible to detect the status of Hide / Show Region.
I have three hide/show regions RX,RY,RZ. When an event EX happens, then region RX should expand and the rest of the region should collapse. When an event EY happens, then region RY should expand and the rest of the region should collapse.
........
...
We can use this JS on DA to change the status of a region:
$("RX.uRegionControl").click();
$("RY.uRegionControl").click();
.....But, first we need to detect the status to know where to apply that DA. ? I am working on apex 4.2. theme 25.
HOW to use variable P_TMPLID in following statement
TYPE typ_unrecon IS TABLE OF REC_' || P_TMPLID ||'_UNRECON%ROWTYPE index by binary_integer;
because its throwing error while compiling
and also in statement
FORALL i IN unrecondata.FIRST .. unrecondata.LAST SAVE
EXCEPTIONS
--STRSQL := '';
--STRSQL := ' INSERT INTO REC_' || P_TMPLID ||'_UNRECON VALUES ' || unrecondata(i);
-- EXECUTE IMMEDIATE STRSQL;
INSERT INTO REC_' || P_TMPLID ||'_UNRECON VALUES unrecondata(i);---throwing error on this statement
commit;
--dbms_output.put_line(unrecondata(2).TRANSID);
EXCEPTION
In the following merge statement in the USINg clause...I am using a select stament of one schema WEDB.But that same select statement should take data from 30 schemeas and then check the condition below condition
ON(source.DNO = target.DNO
AND source.BNO=target.BNO);
I thought that using UNIONALL for select statement of the schemas as below.
SELECT
DNO,
BNO,
c2,
c3,
c4,
c5,
c6,
c7
[code]....
I am using JDBC to run a few queries from my Java program (multi-threaded one).I am facing an issue where a select statement is blocking a delete statement. From the java code point of view, there are 2 different threads accessing the same tables (whith different DB connection objects).
When the block occurs (which i was able to find out from the java thread dump that there is a lock on oracle), the below is the output:
SQL> SELECT TO_CHAR(sysdate, 'DD-MON-YYYY HH24:MI:SS')
2 || ' User '||s1.username || '@' || s1.machine
3 || ' ( SID= ' || s1.sid || ' ) with the statement: ' || sqlt2.sql_text
||' is blocking the SQL statement on '|| s2.username || '@'
4 5 || s2.machine || ' ( SID=' || s2.sid || ' ) blocked SQL -> '
6 ||sqlt1.sql_text AS blocking_status FROM v$lock l1, v$session s1, v$lock l2 ,
7 v$session s2,v$sql sqlt1, v$sql sqlt2
8 WHERE s1.sid =l1.sid
9 AND s2.sid =l2.sid AND sqlt1.sql_id= s2.sql_id
AND sqlt2.sql_id= s1.prev_sql_id AND l1.BLOCK =1
10 AND l2.request > 0 AND l1.id1 = l2.id1 AND l2.id2 = l2.id2;
[code]...
From the above it can be seen that a select statement is blocking a delete. Unless the select is select for Update, it should not block other statements is not it ?
If i inserted the values in table it gets inserting very few rows only.I dont know y it is?
View 15 Replies View RelatedI am trying to correct NMO NOT SETUID-ROOT (UNIX-ONLY) error. On production database (9..7). Googlng this error - it says to run root.sh as root. should this be run in /usr/local/bin. which is the default location.
I don't believe that there would be any problems - but would like some confirmation -to be safe.
I have installed an Express edition of Oracle 11 database on one host (Windows 7) and want to access to from another host (Backtrack Linux based on Debian) from SQL*PLUS Instant client.
While I managed to resolve multiple issues with shared libraries, I am still not able to run the sqlplus command as Oracle. I get the following errors:
oracle@evil:~/instantclient$ sqlplus
SP2-1503: Unable to initialize Oracle call interface
SP2-0152: ORACLE may not be functioning properly
I followed the installation manual by Oracle and also created Oracle user with 2 env. variables set to:
LD_LIBRARY_PATH=/opt/Oracle/instantclient/lib
ORACLE_HOME=/opt/Oracle
Note that I only installed SQPLUS client on Linux and there is no DB running. The version of sqlplus is 11.2.0.3.0
On different forums people advised to set other variables according to the DB installed but I have none. All I want is to run sqlplus with the IP address, SID, port and username. Is it feasible to have only SQL*PLUS client installed .
My example: I'm given an Allowance throughout the week. It happens to be 10 dollars but it can vary from day to day.I can create a running total with SUM(Amt) Over etc...This is the CUMUL column in the example below.
On certain days I've spent different percentages of the allowance. (The SPENT Column which is a field in the database)I can't manage to create the AMTLEFT column in the example below.The AmtLeft column seems to be a kind of running total that 'refers to itself' so this is where I'm stumped.
Week,Day,Amt,Cumul,Spent,AmtLeft
1,Mon,10,10,0%,10
1,Tue,10,20,50%,10
1,Wed,10,30,0%,20
1,Thu,10,40,0%,30
[code]...
My imaginary SQL would look something like at this point (if I have it right):
SELECT Week, Day, Amt, Sum(Amt) Over (Partition By Week, Order By Day) AS Cumul, Spent FROM AllowancesTable
How to get the last column AmtLeft?
My problem is that i don't want to execute a procedure from my scheduler if the previous execute didn't finished. Is there a manage view or table that provide the procedure state?
View 15 Replies View Related From database server, I need to monitor the details about the sql statements which are being currenlt running in client machines.
I tried with V_$SQLTEXT view where I can only see the SQL statements, hash value,address,SQL_id. but I'm not able to get the user name,name the client machine .
find out these details?.Which Data Dictionary i need to use ?.
I have a job that runs two procedure parallely . The code is as follows:
DECLARE
jobno1 NUMBER;
jobno2 NUMBER;
flag NUMBER;
BEGIN
dbms_job.submit(jobno1,'pc;', next_date=>SYSDATE);
dbms_job.submit(jobno2, 'pc2;', next_date=>SYSDATE);
[code]....
And the stored procedure (in SQL File) is as follows:
procedure pc:
create or replace procedure pc
as
begin
for idx in 1..100 loop
dbms_output.put_line(idx);
end loop;
end;
/
procedure pc2:
create or replace procedure pc2
as
begin
for idx in 1..1000 loop
dbms_output.put_line(idx);
end loop;
end;
/
However, when I execute the job , I get the following output:
1
2
3
.
.
.
.
100
[code]....
Which indicates the job 1 got executed 1st and then job2. But this is not what I want.
I have a 11.2.0.3 database runing on AIX. The instance hangs and crashes due to memory usage issues. I checked the alert log of the database and this is what i see:
WARNING: Heavy swapping observed on system in last 5 mins.pct of memory swapped in [11.85%] pct of memory swapped out [3.45%]. make sure there is no memory pressure and the SGA and PGA are configured correctly. Look at DBRM trace file for more details.i also see the following in the alert.log:
Errors in file
/opt/oracle/diag/rdbms/iut3px1/iut3px1/trace/iut3px1_cjq0_55312404.trc:
ORA-00604: error occurred at recursive SQL level 2
ORA-04031: unable to allocate 3896 bytes of shared memory ("shared pool","select audit$,options from p...","sga heap(1,0)","kglsim object batch")
The file contents of iut3px1_cjq0_55312404.trc are:
====================
Process State Object
====================
----------------------------------------
SO: 0x70000007b97de70, type: 2, owner: 0x0, flag: INIT/-/-/0x00 if: 0x3 c: 0x3
proc=0x70000007b97de70, name=process, file=ksu.h LINE:12616 ID:, pg=0
[code]...
I want to calculate the running percentage. sample data is as below.
CREATE TABLE prod
(
code VARCHAR2(8),
name VARCHAR2(30),
stdate DATE,
itons NUMBER(7,3),
rtons NUMBER(7,3)
[code]....
Required Output is
CODE NAME STDATE ITONS RTONS %age
-------- ------------------------------ --------- ---------- ---------- -------
0-01-001 SEEDS 17-JUL-12 193.155 0
1-01-001 OIL 17-JUL-12 0 81.906 42.404
1-02-001 MEAL 17-JUL-12 0 104.304 54.000
1-03-001 DURT OIL 17-JUL-12 0 1.242 0.643
2-01-001 WASTE 17-JUL-12 0 5.703 2.953
[code]....
Percentage will be calculated as rtons of code not having first digit 0 devided by itons having having code 0 result multiply 100 for the same date code wise e.g. For dated 17-jul-13 meal percentage will be calculated as round((104.304/193.155)*100,3)=54.000
We have done cloning of our ORACLE APPLICATION(11i),after that performance of ERP is getting slow (like fetching of data). What we can do to increase the performance.
View 1 Replies View Related we are doing a performance tuning on a large database. Our main aim is to capture all the packages/procedures/view that are running on database. Below given is the format we have prepared
Eg:
SPIdSP_Name CPU TimeI/OLine Executed
1Emp_AllDetails221
1Emp_AllDetails582
1Emp_AllDetails25103
[code]...
Requirement:Write an Procedure that captures the above given information in the background of database and stores the information in a table.write the procedure to capture the above given information.
I have two queries that I need to run and compare the outputs against each other. Each query runs on a different host. I can run each query on a different pane (Window - I am using Toad for running query). What I am trying to do is:
- Run both queries on a single pane
- Compare the output where if a "study" matches on both query output, then display the result.
To being with, is it possible to run the queries on a single pane by defining SID string as a part of query syntax......?
SELECT study,
TO_CHAR (completed_date, 'mm/dd/yyyy') completed_date, status
FROM ...
SELECT study, name
FROM .....