SQL & PL/SQL :: Update Command

Jun 7, 2011

here is my table...

id name bits

A 1 011011101 00
B 2 011011111 01
C 3 100100010 11

Here, I need to write a query to change 0 to 1 and 1 to 0 for every record value in table of bits column.

for ex: 011011101 00 of id - A must be changed to 100100010 11

similarly, 100100010 11 of id - C must be changed to 011011101 00

Now I need to write a query to update values of bits column in one shot.

View 4 Replies


ADVERTISEMENT

SQL & PL/SQL :: Use FROM Clause In Update Command?

Jul 13, 2011

Can we use FROM clause in update command?

View 2 Replies View Related

SQL & PL/SQL :: Combine Update And Insert Command?

Jul 23, 2012

i have a given pl/sql program that first deletes records out of a table and afterwards inserts new rows. now for example 2 rows out of 10 have a foreign constraint and can not be deleted that easily anymore. so i delete the ones i am able to (with the where not exists clause).

now i want to update the records who have a foreign key constraint and the rest with a regular insert. how would i do this the easiest way. i thought i could use insert with a where clause!!

here i have some part from the original

declare
procedure add(
i_id pls_integer,

[Code].....

View 3 Replies View Related

Update Long String Cell By SQL Command?

Jan 23, 2011

I use sqlplus in oracle (linux). I have a table and the string cell have long string . Like below :

CODEcolumn A    Column B
  
A           BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
.....................................BBBBBBBBBBB

So, I need to edit/update the row A and the value in Column B. But the string in Column B is so long and I only need to edit one character. IF I use update command , I need to type very long string and it is easy to wrong edit .

View 1 Replies View Related

SQL & PL/SQL :: Update Long String In Table By Command

Jan 23, 2011

I use sqlplus in oracle (linux).I have a table and the string cell have long string .

Like below :

column A Column B

A BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
.....................................BBBBBBBBBBB

So, I need to edit/update the row A and the value in Column B.But the string in Column B is so long and I only need to edit one character.IF I use update command , I need to type very long string and it is easy to wrong edit .

View 8 Replies View Related

SQL & PL/SQL :: How To Find Out Which Rows Affected By Update Command

Dec 7, 2010

Assume that we have table Test with a column TestId and Status. This table is having 10,000 records. Now, we need to write a stored procedure that does the following:

1) Select top 10 rows whose "Status = NEW'

2) Update the selected top 10 rows with "Status = PROCESSING"

3) Return those top 10 rows.

Assuming there are hundreds of such requests coming to Oracle database, how can we make sure each request NEVER gets a duplicate record at any given point of time and how to fetch the records that have been updated individual request?

View 1 Replies View Related

SQL & PL/SQL :: Update Table With Join / ORA-00933 / Command Not Properly Ended

Jan 18, 2013

I'm unable to get the below update SQL to run in Oracle, it's giving me th below error

ORA-00933: SQL command not properly ended.

UPDATE
PDR.PH_Family_Match_by_Chassis a
SET a.Launched = 'Y'
INNER JOIN
PDR.domCHASSIS
ON
a.chassis_id = PDR.domCHASSIS.chassis_id

[code]....

View 8 Replies View Related

Backup & Recovery :: 11g R2 - How To Update Control File With Switch Command

Oct 3, 2011

I have restored all datafile to new location (that is ASM) earlier it was on file system using set new name command (RMAN). Now when i'm trying to update control file with swicth command it is prompting error. Version is 11g R2.

RMAN> SWITCH DATAFILE ALL;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "all": expecting one of: "double-quoted-string, integer, single-quoted-string"
RMAN-01007: at line 1 column 17 file: standard input

View 3 Replies View Related

Brtools Command Versus Oracle Command For Shutdown And Startup (statistics)

Sep 13, 2013

we are running SAP application against oracle database. say, if I use brspace or brtools (from SAP side) to shutdown or startup database or collect stats, does this mean it not recommend to use oracle command to shutdown/start & collect stats?

View 3 Replies View Related

Forms :: Insert And Update Directly Into Table From Pre Update Trigger Of Block?

May 14, 2010

I have a base table (Table A) block with multiple records displayed. I need to track audits to this underlying table in the following way:

If user updates a field in the block I want the pre-changed record's audit fields to be set and I need to create a copy of the record with the changed values. Basically any changes will result in the record being logically deleted, and a copy record created with the newly changed values.

Tried to implement in the block's pre-update trigger which will call a package to directly update Table A then Insert into Table A, then requery the block. Is there a clean and efficient way to do this?

View 4 Replies View Related

Update Statement Versus Cursor Based Update

Sep 7, 2010

I have to update 20 and 60 million records of a table. The update statement are

1> 20 million recs
update mycustomer set update_time=add_months(sysdate,240) where seq_num = 1;

commit;

2> 60 million recs
update mycustomer set update_time=sysdate-seq_num where seq_num <> 1;

commit;

Q1> Is there any way to improve performance
Q2> Will parallel dml improve performance
Q2> Would a pl/sql cursor make any difference in speed.

View 1 Replies View Related

SQL & PL/SQL :: Update Statement With Join Only Update Matching Rows

Aug 17, 2010

This is my query:

UPDATE t_tt_hours a
SET a.sak_request = (
SELECT b.sak_request
FROM t_requests b, co c

[Code]...

The problem I am having is that it is updating all rows even when it is pulling back a null value for b.sak_request. I've tried adding b.sak_request is not null to the select statement like this:

UPDATE t_tt_hours a
SET a.sak_request = (
SELECT b.sak_request
FROM t_requests b, co c
WHERE b.nam_eds_tracking_id = c.id_dir_track_eds

[Code]...

but it doesn't seem to make a difference. The reason I need to do this is that the difference between where it matches with a valid (non-null) value is 396 rows vs. 12,484 rows which is too time consuming to run on my page.

View 9 Replies View Related

SQL & PL/SQL :: Create Trigger That Will Update Table When There Is Insert / Update

May 29, 2012

i want to create a trigger that will update a table when there is an insert or update.i can't across this error that i don't even know what it means "table %s.%s is mutating, trigger/function may not see it".

*Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.

*Action: Rewrite the trigger (or function) so it does not read that table.

CREATE OR REPLACE TRIGGER set_date_end
BEFORE INSERT OR UPDATE OF issued ON shares_amount
FOR EACH ROW
DECLARE
BEGIN
INSERT INTO shares_amount(date_end) VALUES(SYSDATE);
END set_date_end;
/

View 3 Replies View Related

SQL & PL/SQL :: Update Previous Row Based On Next Row And Update Duplicate Record

Mar 6, 2013

create table test1

( ID NUMBER(11)
,MEMBER_NMBR NUMBER(10)
,CODE_NMBR NUMBER(7)
,ROW_EFCTV_DT DATE
,ROW_TRMNTN_DT DATE

[code]....

insert into test1 values (11007,7462,32,'30/sep/2012','31/dec/9999',3,'25/sep/1998','AUTUMN',1,0,344);
insert into test1 values (11007,7462,32,'30/oct/2012','31/dec/9999',3,'25/sep/1998','AUTUMN',1,0,344);
IDMEMBER_NMBRCODE_NMBRROW_EFCTV_DTROW_TRMNTN_DTFLAG_NMBRBRTH_DTNAMECLAIM_CDAMT1AMT2
1100774623209/30/2012 00:0012/31/9999 00:00309/25/1998 00:00AUTUMN10344
1100774623210/30/2012 00:0012/31/9999 00:00309/25/1998 00:00AUTUMN10344

I have to update the row_trmntn_dt of first row to row_efctv_dt of 2nd row which is 30th Oct 2012 - 1 day i.e. 29th Oct 2012

View 10 Replies View Related

PL/SQL :: Update Multiple Columns With Single Update Statement

May 30, 2013

i am reading the columns value from different table but i want to update it with single update statement. such as how to update multiple columns (50 columns) of table with single update statement .. is there any sql statement available i know it how to do with pl/sql.

View 5 Replies View Related

SQL & PL/SQL :: How To Update Multiple Rows With Different Values Using Update Statement

Mar 21, 2011

I have one doubt about update command in sql. How to update the multiple rows with different values using update statment.

Eg:-

SQL> set linesize 500;
SQL> set pagesize 500;
SQL> select * from emp;
SQL> select empno,ename,sal from emp;
SQL> select empno,ename,sal from emp;

EMPNO ENAME SAL
---------- ---------- ----------
7839 KING 5000
7698 BLAKE 2850
7782 CLARK 2450
7566 JONES 2975
7654 MARTIN 1250

[Code]....

The above table contains 14 records. Now i would like to update the salary column with different values like

EMPNO SAL
===========
7839 18000
7698 20000
7782 5000
...
...
...
7934 25000

How to update above values with single update query.

View 11 Replies View Related

SQL & PL/SQL :: Compound Trigger Update Firing Update

Jan 25, 2012

After many tests I can't make work and update of the same table inside the same table.

Trying to avoid Mutating Table Error now I have
ORA-00036: maximum number of recursive SQL levels (50) exceeded

Sample Data :

create table test_compound (USERID VARCHAR2(10),APP VARCHAR2(15),LAST_UPDATED_ON TIMESTAMP);

insert into test_compound values ('user1','1',systimestamp);
insert into test_compound values ('user2','2',systimestamp-4);
insert into test_compound values ('user3','3',systimestamp-6);

CREATE OR REPLACE TRIGGER trigger_test
FOR UPDATE ON test_compound
COMPOUND TRIGGER
TYPE t_tab IS TABLE OF VARCHAR2(50);
l_tab t_tab := t_tab();
[code].......

When I execute :

update test_compound
set last_updated_on=systimestamp
where userid='user1' and app='1';

The trigger should update the first row and all the data from test_compound table where userid='user1'. Maybe the problem is that updating the same table inside the trigger is firing in a recursive way the trigger.

View 13 Replies View Related

SQL & PL/SQL :: How To Update Multiple Table With Single UPDATE

Jul 19, 2011

I have a column "empno" in EMP table and "deptno" in DEPT table . I want to update both the columns with single UPDATE statement. With out a creation of stored procedure or view(updating it through view).

View 4 Replies View Related

RMAN - Set Command ID

Dec 27, 2011

I can successfully SET COMMAND ID inside an RMAN run block

CODErman <<EOF
connect target
connect catalog ....
CROSSCHECK BACKUP DEVICE TYPE DISK;
CROSSCHECK ARCHIVELOG ALL;
RUN {
[code]...

Can this be setup without a RUN block? I am running on 11.1.07 and 11.2.0.2

View 2 Replies View Related

SQL & PL/SQL :: Command Example In Oracle 9?

Aug 5, 2010

I want to use oracle 9 select * from tab .And use the output to issue "desc XXX " for every row of output in select statement.. .How can I do it automatically ???

View 9 Replies View Related

SQL & PL/SQL :: How To Use DEFINE Command

Jun 5, 2012

set serveroutput on
set verify off
declare
define t1='111';
begin
dbms_output.put_line(t1);
end;
/
define t1='111';
*
ERROR at line 2:
ORA-06550: line 2, column 10:
PLS-00103: Encountered the symbol "=" when expecting one of the following:

:= . ( @ % ; not null range default character

The symbol ":= was inserted before "=" to continue.

View 5 Replies View Related

SQL & PL/SQL :: Use Of RAISE Command?

Aug 31, 2011

explain to me what the "RAISE" command does in PL/SQL for the following code.

EXCEPTION
WHEN OTHERS THEN
INSERT INTO TMP_ERRCHECK(
PP_CD,
IHS_CD,

[code]...

Tried searching for some explanations but I still do not have a clue as to what the RAISE actually does. Do I even need to put it in the code?

View 3 Replies View Related

SQL & PL/SQL :: Pivot Right Command To Use?

Aug 28, 2011

I have the following table structure:

PK1,PK2,PK3,A1,B1,C1,A2,B2,C2

Which I want represent as follows:

PK1,PK2,PK3,A1,A2
PK1,PK2,PK3,B1,B2
PK1,PK2,PK3,C1,C2

Is pivot the right command to use? If so, how do I do this? Most pivot examples I've looked at use an aggregate like SUM, which is not really want I am trying to accomplish here.

View 4 Replies View Related

PL/SQL :: Use Of MOD Command In Query

Jun 7, 2012

what is the use of MOD command in query.Does it have performance benefit.

View 11 Replies View Related

SQL & PL/SQL :: Create Trigger To Update Table B After Update On Table A

Jul 21, 2011

I have table test1(id,name) and table test2(id,,name)

Now when I update name column of a row on test1 I want the same value to be updated for the same id in test2.

So I wrote this trigger but its not working

create trigger test_trigger after update on test1 for each row
begin
update test2 set name=new.name where test2.id=id
end
/

View 9 Replies View Related

Adrci Purging Of Command?

Sep 27, 2011

I am using the following command within a shell scrript to purge files with adrci

adrci exec="show homes"|grep -v : | while read file_line
do
echo "adrci purging diagnostic destination " $file_line
echo "purging ALERT older than $Minutes ..."
adrci exec="set homepath $file_line;purge -age $Minutes -type ALERT"

[code]...

Is there a command I can use to see what will be purged or what has been purged?

View 2 Replies View Related

Sqlplus Copy Command

Feb 15, 2013

i am trying to copy the data from a remote database which has Oracle 8i thru Sqlplus copy command to the local database which has Oracle 11gR2.

copy from abc/abc@remote
insert emp_new
using
select *
from emp_old
where rownum < 1001;

is it possible to copy the remote database thru sqlplus copy command ?

View 6 Replies View Related

SQL & PL/SQL :: Execute Immediate Command Error

Oct 14, 2011

I am facing a problem regarding the execute immediate command. I have created a procedure as given below

SQL> set echo on ;
SQL> set serveroutput on;
SQL> declare
2 l_var varchar2(50);
3 sqlstring varchar2(3000);
4 begin
[code].......

In this procedure the execute immediate command shows error ( if i avoid exception).I have tried other syntax too of this command
but it is showing error only.

View 13 Replies View Related

SQL & PL/SQL :: Run Command And Connection In One Line

Dec 5, 2011

I want run sql connection and command in one line , something like this ...

sqlplus "/as sysdba" 'select * from dual'

is it possible to do it in one command ?

View 3 Replies View Related

SQL & PL/SQL :: Copy Command In A Procedure

Feb 22, 2010

I got to pull 30M data into local DB from a remote DB. As of now we have procedure to perform this task using an

Insert /*+append*/ table1
select *
from rdb_view;

I observed using the copy command in sql plus has taken very less time than the procedure.Can we use the Copy command inside the PL/SQL block? I tried with dynamic SQL but It is not allowed I guess.

View 16 Replies View Related







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