SQL & PL/SQL :: How To Stop Update In PK Column

Apr 1, 2012

HOW TO STOP THE UPDATE IN PK COLUMN?

View 3 Replies


ADVERTISEMENT

SQL & PL/SQL :: How To Update Data In A Column From Another Column

Dec 28, 2010

I was wondering how can I do below statement in oracle

update table1 t1 set t1.column1 = t2.column2
from table2 t2 inner join table3 t3 on t3.column3=t2.column4
where t3.column5 is null

I tried read up merge and update, but not really understand how the syntax works in oracle.

View 2 Replies View Related

Update New Column Within Same Table

Oct 22, 2010

I have a table ITEM as under;

ARTICLE VRTCODENAMESTATUSNEW_NAME
4KABAN.NM.12.21121143SU19I
4KABAN.NM.12.21564101SU23I
4KABAN.NM.24,5.22491015SR08I
4KABAN.NM.24,5.23181038SR22I
4KABAN.NM.24,5.23491015SR08I
4KABAN.NM.24,5.24121161SR26I

how to update the filed from NAME to NEW_NAME, I need following output.

ARTICLE VRTCODENAMESTATUSNEW_NAME
4KABAN.NM.12.21121143SU19ISU19
4KABAN.NM.12.21564101SU23ISU23
4KABAN.NM.24,5.22491015SR08ISR08
4KABAN.NM.24,5.23181038SR22ISR22
4KABAN.NM.24,5.23491015SR08ISR08
4KABAN.NM.24,5.24121161SR26ISR26

View 2 Replies View Related

SQL & PL/SQL :: Update Same Column With Different Values?

Dec 6, 2012

updating the column values.

Test data:

CREATE TABLE test_at(nr_a NUMBER, nr_id NUMBER) TABLESPACE ECLP_DATA01
INSERT INTO test_att VALUES(90270091,NULL);
INSERT INTO test_att VALUES(90270091,NULL);

[Code].....

I need to update "nr_id" column of test_at table with the values from test_d table. They can be udpated in any order.

I tried to update using rownum but it failed with "single row subquery returns more than 1 row...."

View 16 Replies View Related

SQL & PL/SQL :: Dynamic Update Of Column Name?

Jan 23, 2012

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

View 4 Replies View Related

SQL & PL/SQL :: Get Old Value Of Column In Update Statement

Sep 17, 2007

While updating a table, is it possible to get the old value of a column. I need to get it inside a PLSQL block and not in a trigger.for example :-

DECLARE
l_amountNUMBER(5) := 0;
BEGIN
UPDATECustTransactions
SETamount = 150
WHEREcust_id = 5412
RETURNING amount INTO l_amount;
DBMS_OUTPUT.PUT_LINE ( 'l_amount= ' || l_amount );
END;

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.

View 6 Replies View Related

SQL & PL/SQL :: How To Update Column Value Without Using Sequences

Apr 17, 2013

I am having a table with out a primary key .It also contains data.

My requirement is to add a new column to the table and update the column value with unique and sequential number , starting from 1 to end of rows.

This has to be done without using a sequence.

View 2 Replies View Related

PL/SQL :: Update A DATE Column

Mar 14, 2013

There is a need for me to UPDATE a DATE column from one date to another. So as an example,

we have TABLE A and Table A has a column (DATE_TO) with date field value off

DATE_TO
31-DEC-99
12-APR-15
15-MAR-16

What I want to do is update '31-DEC-99' to '31-MAR-13' and for it to only effect '31-DEC-99' (the others are fine).

View 11 Replies View Related

PL/SQL :: Update A Column With Tab Delimited

Jul 18, 2013

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.

View 2 Replies View Related

Does Update On A Partitioned Column Cause Fragmentation

Apr 11, 2008

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 ?

View 5 Replies View Related

SQL & PL/SQL :: Update When ID Column Is Matched / But One Of Others Columns Not

Mar 12, 2013

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]....

View 2 Replies View Related

SQL & PL/SQL :: Update Clob Column Using Execute Immediate?

Aug 30, 2010

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.

View 3 Replies View Related

SQL & PL/SQL :: How To Update CLOB Column In A Particular Table

Feb 21, 2011

How to update a CLOB column in a table, suppose the string is greater than 4000 size.

View 7 Replies View Related

SQL & PL/SQL :: Update Test Table On ID Column

Feb 21, 2012

CREATE TABLE TEST
(
NAME VARCHAR2(1000 BYTE),
ID NUMBER
)

[Code]...

I want the update the TEST table with TEST1 based on id column,i tried as like.it's not working..

UPDATE test t1
SET t1.ID = ( select ID from test1 t2
where t1.name = t2.email and rownum=1 )

View 13 Replies View Related

SQL & PL/SQL :: How To Update Some (old) Records In One Column Of Table

May 26, 2011

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 .

View 26 Replies View Related

SQL & PL/SQL :: How To Use DECODE For A Column In Update Statement

Apr 9, 2010

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.

View 2 Replies View Related

SQL & PL/SQL :: Update Column - Add Two 00 After Alter Table

Apr 14, 2012

I have a table PR in that some data is there for instance, My Mr_NO was Char(11) I modify MR_No to Char(13)My Table Structure now is:

MR_No Char(13),
Mr_Date Date

My Previous data is MR_NO=APN00209085

I want to add two 00 after alter the table I want my result data like APN0000209085.I am updating through this command

update PR set Substr(MR_No,4,2)='00'

ERROR at line 1: ORA-00927: missing equal sign

Result I want is APN0000209085

View 13 Replies View Related

SQL & PL/SQL :: Update Single Column In X Table

Sep 2, 2011

i need a query for update..the logic is

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.

View 2 Replies View Related

SQL & PL/SQL :: Error While Trying To Update A Column In Table

Jul 31, 2013

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]....

View 10 Replies View Related

SQL & PL/SQL :: Update Column To Consecutive Number?

Apr 14, 2011

create table test_table(
rn varchar2(10),
col1 varchar2(10),
col2 varchar2(10),

[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;

this gives ora-00933

View 6 Replies View Related

Update A Column Based On Another In Same Table

Apr 1, 2012

I am trying to update a column based on another column in the same table (student table) and a column from another table (school table)

Code is:

update student_table
set student_code =
(select l.student_code
from school_table l, student_table n
where l.school = n.schoolname)

I get the following error ORA - 01427 Single-row subquery returns more than one row.

View 1 Replies View Related

PL/SQL :: Update SAME Column Name In Two Tables From ONE Query

Oct 15, 2012

is it possible to update a same column name in two tables.

I have two tables in same schema

(1)table name
pem.igp_parent
column name
igp_no.
igp_type

(2)table name
pem.igp_child
column name
igp_no.
igp_type

i want to update igp_no column in one query, how it would be possible.

View 2 Replies View Related

Forms :: One Column Show Two Field Also Update

Jun 23, 2012

I have a table in which three field.

1)empid (Save employee code)
2)attendace_time (Save Date and inout time)
3)status. (Save in out Status).

I generate new form. which have four field.

1)empid
2)attendance_date base on attendance_time 3
3)Attendace_time base on attendance_time
4)Status .

Problem is that when i update the Attendace_time . date save first date of the month. when i update the attendance_date time save 12:00

View 1 Replies View Related

SQL & PL/SQL :: Update Table Removing First 2 Digits From Column?

Apr 10, 2013

I have a table like:

0035987850 P
0035987851 P
0035987852 P

I would like to update removing 00 in the first column. So after update to have:

35987850 P
35987851 P
35987852 P

View 5 Replies View Related

SQL & PL/SQL :: Update Num_songs_in_album Column In Album Table

Nov 23, 2011

I want this trigger to automatically update the num_songs_in_album column in the album table whenever rows are inserted or deleted into the Track table.

SQL> CREATE OR REPLACE TRIGGER update_num_songs_in_album
2 BEFORE INSERT OR DELETE ON Track
3 FOR EACH ROW
4 BEGIN
5 IF INSERTING THEN
[code]....

View 8 Replies View Related

SQL & PL/SQL :: Update Two Table Column In Single Query

May 25, 2012

How to update two table column in single query ?

example :

update table1 t1 ,table2 t2
set t1.column = 'Yes',t2.column='Yes'
where t1.emp_code =t2.emp_code ;

View 1 Replies View Related

SQL & PL/SQL :: Update Column With Total Number Of Records

Apr 3, 2012

Table : Customer

Cust_idNameid
227ABC1
227ABC2
227ABC3
228XYZ1
228XYZ2
228XYZ3
228XYZ4

In one oracle table (Customer) we have multiple cust_id based on that, we want to populate id column as cust_id record count.

I have id column right now null and want result same as above.

View 1 Replies View Related

SQL & PL/SQL :: Update Blob Column With Images From A Directory

Jan 17, 2012

i have to update the blob column in a table with new image.

we have a table with 10 columns in which one column is 'image' as BLOB data type, and one more column with "image_name " and has more than 1000 rows.

I have a 300 images which I need to update in "image" column .

I need to match the given images name with "image_name" column, if row is present in the table than update the "image" column with the given image.

I search and found almost same code to insert the image in new table with a procedure, I mean code is to call the procedure, ( by passing image name and image directory)

Is there any way that we will check all the image given in the directory, if that image_name is present in the table then update the image provide me a sample code for this

View 2 Replies View Related

PL/SQL :: Update A Single Column Data In 10 Tables?

Oct 2, 2012

We have to update a single column data in about 10 tables which has child/parent table relations, pk/fk constraints.. The column that we are updating is a part of primary key in half of the tables and part of foreign key in the other half tables.. I'm thinking of disabling all the foreign key constraints in the tables then update the column data then enable the foreign key constraints in these tables.

View 7 Replies View Related

SQL & PL/SQL :: Update One Value In A Column For Giving Password By Superuser?

Dec 9, 2010

how can i authenticate through check constraints or plsql procedure to update one value in a column for giving password by superuser?

View 2 Replies View Related







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