I have a stored procedure that does a "select name into v_name" SQL statement, which works fine. The only problem is when the query finds no data (the procedure will error because there is no value to put into the variable). Now i have a work around to this by running the query first with a count statement (which will always have results) and then if it is not equal to 0, then i will run the select into.
My question is, is there a better way to handle this kind of issue?
I am doing simple project, where i need to check date(form which we give in run time) with database column date.problem i have written the code for program now i found that select statement is return multi rows.
The following code is working fine,But the thing is if column already exists in the table,then also the other statements should be executed instead of coming out of procedure.SO how can I handle that exception??
SQL> CREATE OR REPLACE PROCEDURE sp_execparameters(tname IN VARCHAR2, colname IN VARCHAR2,datatype IN VARCHAR2) 2 AS 3 v_sqlstr1 VARCHAR2(1000); 4 BEGIN 5 v_sqlstr1 := 'alter table '||tname||' add '||colname ||' '|| datatype ; [code].........
we are using oracle database. We hold the company records in the database. The records of the company should be available at anytime but over years the database keeps growing. Now how to handle the old data. All the data is important but if this goes for few more years then we need more and more disk space to handle. Is there any efficient methodologies to handle the old data? For us old mean the data that is 10 year old.
1.Header(Contains the File Name,Branch Name,MIS date) 2.Body(Customer Details) 3.Footer (File Name,Contians Total Number of Records and Number of Customers)
from the above code I want to execute both the inner block exception and outer block exception and is there any way to pl/sql engine that execute the outer exception first and inner next
I trying to Assign XML content to the clob variable inside the pl/sql block, But i am getting the Below Error:
declare t clob; begin t := 'xml content exceeds 32000 characters'
update test clob_cloumn = t; where id =2;
exception when others then null; End;
ORA-06550: line 5, column 4: PLS-00172: string literal too long
I need to handle this exception, i know it length exceeds 32000 characters, but even though i need to handle the exception and to perform other operation after handling the exception.
I'm working on a plsql program and i'm using collections. I loop the collection and delete rows of it depending on the edits of my program. Here is the question.
if my collection holds rows [1]value [2]value [3]value
i can simply do something like FOR indx in invoice.first..invoice.lasthowever if i delete row 2 of my collection i get an error. no data found. ive been researching this site
[URL].......
rows [1]value [3]value [4]value
is there a way to tell plsql i just want it to loop the collection from top to bottom regardless of the index values?
Physically DB1 .... DBN connected sequentially, so I want to prevent segmentation if some DB is unaccessible, but at the same time fight unneeded redundancy which uses too much link bandwidth to send N-1 LCR-s to all members of a single N-way group (so I want to split one big N-way zone into smaller ones and sequentially connect them into chain - it significantly reduces load on link if N is big enough (>10)). Also I want to have 2 DB in intersection zone to prevent single point of failure.
This scheme has one drawback - if change originated on DB3 or DB4, then it will be propagated (more correctly - applied and captured again) to DB5 and DB6 by both DB1 and DB2 (and, as far as I know, I have no means in capture rules to detect state of DB2 from DB1 and vise versa), so on DB5 and DB6 I get:
but it seems that it does not handle uniqueness conflicts. What is the best way to handle uniqueness conflict (is there a better way than to write custom error handler) and how serious is the impact on insert performance of having unique constraint and corresponding error handler. (In real world I will have to deal with tables with metainformation and without any keys).
Also, how to proceed with no error or raise exception from apply error handler with error that caused this handler to run? In oracle docs I can find only example that modifies LCR and runs lcr.EXECUTE(TRUE), but what to do if I don't want to reexecute LCR, but merely check error code and propagate error if it is not ORA-00001?
I created a custom type what it has a clob member variable:
CREATE TYPE custom_type AS OBJECT( c_type INTEGER, c_number NUMBER(38, 8), c_varchar2 VARCHAR2(4000 CHAR), c_clob CLOB, [code]........
The inserting and updating works with constructor: ... custom_type (to_clob('foo')) . But if the data is longest than 4000 characters then the PHP isn't access to it.
So: The normal case: $sql = ("INSERT INTO table ( clob_field ) VALUES ( EMPTY_CLOB() ) RETURNING clob_field INTO :clob"); $stid = oci_parse($conn, $sql); $clobdescr = oci_new_descriptor($conn, OCI_DTYPE_LOB); oci_bind_by_name($stid, ':clob', $clobdescr, -1, OCI_B_CLOB); oci_execute($stid); $clobdescr->save('more than 4000 chars'); ...
This case: I tried: $sql = ("INSERT INTO table ( ctype ) VALUES ( custom_type(EMPTY_CLOB()) ) RETURNING ctype.c_clob INTO :clob"); $stid = oci_parse($conn, $sql); $clobdescr = oci_new_descriptor($conn, OCI_DTYPE_LOB); oci_bind_by_name($stid, ':clob', $clobdescr, -1, OCI_B_CLOB); oci_execute($stid); $clobdescr->save('more than 4000 chars');
ORA says: "ORA-00904: CTYPE.C_CLOB: invalid identifier";
I am trying to execute the below package. While executing i face a problem where when NO DATA FOUND the excpetion is handled and coming out of the loop.but i want to to continue the loop after handling the exception.
Is there anyway i can modify the code
CREATE OR replace PACKAGE BODY pkg_purge_archive_check AS PROCEDURE Purge_archive_tables_check (purgerows IN NUMBER) IS v_num_1 NUMBER(10); v_num_2 NUMBER(10); v_multiplier NUMBER(10);
I am trying to handle PK violation error on a certain table, on INSERT, my best guess is I should use a trigger. The basic idea is this:
The table consists of 7 columns, and 6 of them are PK, and the seventh one is "amount". I want to handle PK violation in such way that, if it occurs during INSERT, then instead of inserting a new row, it should just update the "amount".
declare type osd_refone is ref cursor; osd_ref osd_refone; l_status number; [code]......
abc_reports in this pack "ab_report" it is the function it having the ref cursor as out parameter . when am executing the above anonymous block am getting the below error,so how can i print the out ref cursor data in my block.
ERROR at line 8: ORA-06550: line 8, column 12: PLS-00221: 'OSD_REF' is not a procedure or is undefined ORA-06550: line 8, column 3: PL/SQL: Statement ignored
create table myex(qid number, lid number, myname varchar2(20), status varchar2(30)); insert into myex values(1,1,'uu',null); commit; CREATE OR REPLACE PACKAGE mypack IS PROCEDURE p_get (in_qid myex.qid%TYPE, out_mycur OUT SYS_REFCURSOR); end mypack; /
[code].....
Note the one record in the table does not satisfy the cursor query criteria, So I try to pass in 1 to see what happens.
In sqlplus: var out_mycur refcursor; begin mypack.p_get(1,:out_mycur); end; / print out_mycur;
I want to insert into two separate tables using the following logic :
If date1 is not null or no1 is not null then insert into target_table1(id,date1,no1) If date2 is not null or no2 is not null then insert into target_table2(id,date2,no2)
Recently I noticed EM web wasn't working, I suspect it happened because i configured EM before adding server to domain. Anyway I decided to drop de repository and re-create it but now i am facing a some errors:
Database SID: orcl java.io.IOException: The handle is invalid at java.io.FileInputStream.close0(Native Method) at java.io.FileInputStream.close(FileInputStream.java:245) at sun.nio.cs.StreamDecoder$CharsetSD.implClose(StreamDecoder.java:505)
[code]....
You have specified the following settings
Database ORACLE_HOME ................ c:\oracle\product\10.2.0\db_1 Database hostname ................ ora01 Listener port number ................ 1521 Database SID ................ orcl Email address for notifications ............... Outgoing Mail (SMTP) server for notifications ...............
[code]....
So now i am facing all these java errors and my EM isn't working.
S.O. = Windows Server 2003 SP 2 x64 Oracle 10.2.0.4.0
the more customers we have for our software solution the more individual oracle objects (Tables, Packages, Functions, etc.) we have in our scheme. Right now we separate these by giving them identifying names like "X_CUSTOMER1_TABLENAME" e.g. (I know ..... )
This is not very practical when keeping our reference clean and when deploying/syncing our reference with a customer db: One customer would receive the objects of other customers on a deploy.
Is there a common solution to this problem? We were thinking about having a separate scheme for each customer. That way we would have our standard, untouched scheme with the basic functionality and the customer schemes with the individual content.
To make it a bit more concrete: We have around 100 basic tables that make the most of the content/functionality of the software. Each customer might have between 1 -5 additional tables with "custom" data that is used in conjunction with the standard objects in individual packages, functions etc. The installations will be made on our customers systems. So I have in mind to have schemes 0001, 0002, etc for each customer IN OUR REFERENCE. But we would then deploy only the scheme for that certain user when installing on their system. So for example for customer 0001 I would deploy the STANDARD and 0001 scheme
I am using sql loader to load data to tables from tab delimeted files.
Here the problem is that the sql loader is not handling null values. If there is any null value in the flat file it is moving the field values to left and loading to the table. I am using NVL function to handle the null values, but it is not working.
My control file is: LOAD DATA INFILE 'C: da_poc_filesSQL_scriptsSourcefilesTRADEGLOBNODE1.TXT' BADFILE 'C: da_poc_filesSQL_scriptsBadfilesTRADEGLOBNODE1.bad' DISCARDFILE 'C:C: da_poc_filesSQL_scriptsDiscardfilesTRADEGLOBNODE1.dsc'
[Code]....
Source file is attached to this link For the attached file in the first record, tradedate value is coming in to tradeprice field
I have some problem with '/' into the .sql files: after anonymous blocks - it haven't applied without '/'; Also not-anonymous block applied twice when we have both ';' and '/'. I need to report about problems before file will apply.)