I have something upcoming task which include a merger of two database instances. The schema structure is exactly same and there is no duplicity problem. I want to dump the both schema data in one instance. The only challenge i have here is "How to manage the sequences?".
Explanation: Instance A. Sequence : 1,2,3,4,....20 Instance B Sequence: 1,2,3,4....20
We have a requirement to install a new application into a 2 node RAC database.
Going over the installation scripts, I noticed that there is a requirement to use sequences, which immediately set the alarms ringing - I know that using sequences with RAC may cause issues (esp as the script is set to cache 500 values at a time).
The way we are planning to implement this application is by channeling the application through a service that is preferred on one node. The second node will be set to available for the service. The database will ONLY be used for this application.
Will this be enough to get round this situation? Or will the second node still try and cache sequence numbers?
I have created a Sequence called testseq. Its working fine since last 1 week. Suddenly no one sequences will not create nextvalue. after executing nextval its return null row.
I have a temp table and want to insert that data into 2 tables. In both of my tables i have a sequence column but in my second table its a foreign key to the main table
up_query="INSERT INTO AFFILIATE (FNAME,LNAME,EMAIL,PHONE,ORG,ADDRESS1,ADDRESS2,COUNTY_ID,AFF_ID) Select a.FNAME, a.LNAME,a.EMAIL,a.PHONE, a.ORG, a.ADDRESS1, a.ADDRESS2,C.COUNTY_ID,'AF'||aff_seq.nextval FROM temp_aff A LEFT OUTER JOIN COUNTY C ON UPPER(A.COUNTY)=C.CNAME"; $up_query2= "INSERT INTO TEST4 (DEPT_ID,CAMP_ID,AFF_ID, PASSWD) SELECT D.DEPT_ID,C.CAMP_ID,aff_seq.currval,'Zq'||dbms_random.string('A',4)||'$8' from dual,TEMP_AFF A left outer join DEPT D ON (UPPER(A.DEPT)=UPPER(D.DNAME)) left outer join CAMPUS C ON (UPPER(A.CAMPUS)=UPPER(C.CPNAME))";
However in my test4 table its inserting the aff_seq.currval for all records. Its not incrementing as in the affiliate table.
i have creatd view,in which i need to show the entry of year in column wise,though the data is in row /record wise.By iteration i can manipulate the year in decode function like " (DECODE(a.Year,(select distinct max(year)-1 from BI_BALANCE_SHEET), a.Balance))",but is there any way to chachge the alias name /column name,here is the query
select SUM(DECODE(a.Year,(select distinct max(year)-1 from BI_BALANCE_SHEET), a.Balance)) as year2010, SUM(DECODE(a.Year,(select distinct max(year)from BI_BALANCE_SHEET) , a.Balance))as Year2011 from DEMO a
By using the RETURNING clause i am getting the new updated value. I need the old value for some processing. Do i have to explicitly query it before the update stmt? Pls reply.
I need to update a column with tab delimited ie that column value should be tab delimited. Eg:- Url_name is the column and column values =[URL]. THe space between [URL] should be tab delimited. I wanted to use a update query to update this values with tab delimited.
Does "Update on a Partitioned Column" cause fragmentation ?
See example below :
Suppose I have a table as below that has approx 3 million rows and growing :
1) Table ABC : file_id number status_flag varchar2(1) file_Content clob date_created date
2) This table is list partitioned on Column "status_flag".
Column "status_flag" can take 3 values "A" or "B" or "C"
3) A file_id can transition from 1 "Status_flag" to another. [ A--> B , C--> B, B-->C, A --> C, etc ]
This means its possible to UPDATE the "status_flag " - the partitioned column.
Question : ------------- 1) Would the movement of rows from 1 partition to another cause fragmentation ? 2) Or Instead, should this be achieved by maintaining 3 tables - 1 each for every "status_Flag" as Table_A, Table_B, Table_C
This would mean that, if file_id 1, changes "status_flag" from 'A' to 'B' : -- The corresponding row from Table_A will be created in Table_B --- The same will be deleted from Table_A
This would still cause fragmentation ... with the overhead of Inserting a CLOB column from 1 table to another.
3) How to determine how much percent of the table is fragmented ?
my need is to perform merge - update when id column is matched, but one of others columns not.When id column is not matched then I perform insert.
It works fine for matched or not matched id column.
Commented code is my try to perform check for others columns, The code should not update when all columns match. It should update only when on of columns doesn't match (except id column of course, because it's key column).
begin merge into copy.table1 rr using ( select ID , DEALID , ESTIMATIONDATE , BOUNDOVERESTIMATDATE , ESTIMATIONTYPEID , MARKETAMOUNT , LIQUIDATINGAMOUNT , [code]....
I am encountering an error message while updating a xmltype column using dynamic sql statement. I am using dynamic sql here as the table is not placed in the same schema from where the plsql procedure is invoked. The schema name is passed to the procedure as an argument. I am using below pseudo code for this purpose.
Create procedure myproc(p_schemaname varchar2, p_id number) is p_clob clob; p_str varchar2(2000); begin
[code]...
This is throwing an error 'missing expression' at the line of 'exeute immediate'.
But it works if I run a static sql update by hard coding the schema name in the statement.
i have a table in my PD database which have more than 30,000 records .some records in a column say p_code is not tagged with code like '9876543'while other records are tagged in this column with code such as '19022345678'.
Now i want to update these records with tagging 1902 with each one .
I have to conditionally update a set of columns in a table. If the column status_code_stage_3 IS NULL THEN I have to update the column status_code_stage_2. The below query is giving error:-
Test Table create scripts CREATE TABLE test11( date_stage_3 date, reason_code_stage_3 varchar2(20), reason_code_stage_2 varchar2(20), opportunity_date date ) INSERT INTO test11 values(sysdate,'reason1',NULL,sysdate) INSERT INTO test11 values(sysdate,NULL,'reason2',sysdate)
[code]....
how to work out the update statement to use the conditional statement for columns.
i have to update a single column(x.c) in x table.here the condition is x.a is not null and x.b is not null x.d is null then update x.c=x.b for each row.
I have a scenario where I need to update field in report_input table.It has bind variables in it which will be prompted while running the query.I see that QUERY_VALUE field that need to be updated has length of VARCHAR2(3000).
desc report_input Name Null Type ----------------- -------- -------------- QUERY_NAME NOT NULL VARCHAR2(64) QUERY_VALUE NOT NULL VARCHAR2(3000) [code]....
I want update col1 whis is null to max(col1) ++ in a row, order by cr_date like 1,1,20110102 2,2,20110101 3,null,20110105 => 3,5,20110105 because this row is after 20110103 4,3,20110104 5,null,20110103 => 5,4,20110103 because this row is before 20110105
update test_table set col1 = (select max(col1) from test_table) + rownum where col1 is null;