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?
i am more than ready to RTFM, if any of the members give me the right pointers to proceed. My company has a replication issue, which my manager asked me to check anything i can. This can be pure architectural question where i will have redesign the application, i am also ready to read on any design patterns and change code
Basically, we have a Primary Publisher in US and the Subscriber in UK. I am told that the replication setup is MASTER - MASTER. Any updates in US will update the servers in UK and vice versa. The .Net application is client machine hosted application which does the changes in the local server respective to its geographical domain i.e applications running in U.K will update the U.K server only. Once the update is done, the data is replicated to other server. It works well most of the time, but sometimes when the user is updating the same record in US and U.K at the same time. The Replication breaks, since before updating either server, if the row in the table is in different due to an user update, replication breaks.
point me to any solutions either Oracle Replication design wise or .net application design wise.
I am using textarea item to enter and save data into table but saved data doesn't retain all formatting eg line breaks so how can i format the text entered in the textarea so it retains line breaks when saved in the table or sent in the email via APEX_MAIL.SEND... in APEX 4.1.1,
There is a nested table with in a nested table type and i want to print the value and again assign a new value to the next subscript and i have tried a lot but couldn't find any solution.
declare type type_name is table of varchar2(10); type type_name1 is table of type_name; names type_name1:=type_name1(type_name('hello')); begin -----HOW TO PRINT A VALUE-------- -----HOW TO ASSIGN A NEW VALUE TO NEW SUBSCRIPT null; end;
1) need to print the values of names(1) 2)Assign a value to names(2)
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?
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.
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)
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.