SQL & PL/SQL :: Multiple Field Update

Jun 11, 2011

I have a requirement to load data into database column based on the value coming from input field.

E.g. :

Input:

EmpNo, DeptNo, Sal
1234, 10,1000
1234,20,2000
1234,30, 3000
1234,40,4000
2345,10,100
2345,20,200
2345,30,300

Output:

Emp No, Dept_10_Sal,Dept_20_Sal,Dept_30_Sal,Dept_40_Sal
1234, 1000, 2000,3000,4000
2345,100, 200, 300,0

Here we have more than 500 columns like this Dept_10_Sal, Dept_20_Sal........Dept_500_Sal.

View 32 Replies


ADVERTISEMENT

Forms :: Update Field Based On Another Field Checkbox

May 3, 2013

I have a table where i need to update one field values based on another field of the same table , simply as it is.I have done this using one select all check box , on clicking that all check boxes of item_trans table will get selected , then i will un select some of check box and then using one button, i will update the value of the fields which are checked only.

I have put the sample code but when i am updating its taking long time and hanging.I am also attaching the form based on the test case provided.

--tables with insert statement
create table item_trans (trans_item varchar2(12),trans_qty number,trans_act_qty number)

insert into item_trans(TRANS_ITEM,TRANS_QTY,TRANS_ACT_QTY) VALUES ('TREE1',40,NULL);
insert into item_trans(TRANS_ITEM,TRANS_QTY,TRANS_ACT_QTY) VALUES ('TREE2',20,NULL);
insert into item_trans(TRANS_ITEM,TRANS_QTY,TRANS_ACT_QTY) VALUES ('TREE3',20,NULL);

--i want to set the value of trans_Act_qty as trans_qty

--i create one dummy or test block to keep the select all check box. for that table test script is

CREATE TABLE TEST
(
C VARCHAR2(2000 BYTE),
B NUMBER,
A NUMBER
);

insert into test (C,B,A) values ('A',1,1);

--code written in select all check box which is created on test.block.

BEGIN
GO_BLOCK('item_trans');
FIRST_RECORD;
LOOP
:M_END_YN := :M_END_ALL;
[code].......

--code written in M_END_YN ( actual check boxes where i will uncheck).

IF :M_END_YN = 'N' THEN
:M_END_ALL := 'N';
END IF;

--code written on button to update those values which are checked.

BEGIN
GO_BLOCK('item_trans');
FIRST_RECORD;
LOOP
IF :M_END_YN = 'Y' THEN
[code]......

View 5 Replies View Related

Update Field With 1st 9 Characters Of Another Field In Same Record?

Apr 23, 2009

I need to update a field with the 1st 9 characters of another field in the same record.

View 1 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 :: 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

SQL & PL/SQL :: Update A Field

Jun 16, 2011

Trying my best to follow the posting guidelines.

There are two tables.

orderheader and orderdetails. orderheader is a master table and orderdetails is a detail table. So for every one record in orderheader table, there are many records in orderdetails table. I want to update a field in orderdetails table from a orderheader table using inner join.

update orderdetails
set orderdetails.conversion_dt =
(select orderheader.conversion_dt
from orderheader, orderdetails
where orderheader.number= orderdetails.number )

I get the following error:

Error report: SQL Error: ORA-01427: single-row subquery returns more than one row 01427. 00000 - "single-row subquery returns more than one row"

*Cause:
*Action:

What mistake am I doing here?

View 16 Replies View Related

Execute UPDATE From Field That May Have More Than Row

Jun 29, 2010

I am trying to execute an UPDATE from a field that may have more than row. I get ORA-01427: single-row subquery returns more than one row.

I need to set the careof column in owner table to hold the name (NAM) from the alt table if the alttype from alt is ATT. We could have more than one id and the careof names can be different.

This is my query:

UPDATE owner s
SET s.careof = (SELECT a.NAM
FROM alt a
WHERE a.taxyr = '2011'
AND a.alttype = 'ATT'
AND a.card in ('0')

[code]....

View 1 Replies View Related

SQL & PL/SQL :: Update Table Field From Another?

Mar 28, 2011

I'm trying to update a field from another field in the same table.

I got a Table with 3 fields.

CREATE TABLE CONTENT
( LID_id NUMBER(6,0) NOT NULL ENABLE,
LPRECIS VARCHAR2(4000 CHAR),
LCOMMENT VARCHAR2(4000 CHAR)
)

How to update "LPRECIS" from "lCOMMENT" only where "LPRECIS" is NULL ?I used this statement but it's wrong.

UPDATE CONTENT
SET LPRECIS=(SELECT LCOMMENT
FROM CONTENT
WHERE LPRECIS IS NULL)

View 2 Replies View Related

PL/SQL :: Parse Multiple Items In A Field

Apr 1, 2013

I have a field that contains many part numbers. There can be 2 or more part numbers in the field separated by a space. How can this be dynamically read so you can compare the contents in the where clause to what you are search for? Example Part Numbers in the field: 1X 2X 3X 4Y 5Y 7Y

I would like to read the field and make rows out of the data.

1X
2X
3X
4Y
5Y
7Y

View 3 Replies View Related

Update Field AA With Zeros Before Number

Oct 30, 2011

i need to update field AA with zeros before the number (max 4 digits) for example: 1 = 0001 , 13 = 0013 , 1234 = 1234 .

View 1 Replies View Related

SQL & PL/SQL :: Get Single Row From Multiple Duplicate Values Of One Field?

Sep 10, 2012

CREATE TABLE prim_tbl
(id NUMBER,--- id is not primary key here
description VARCHAR2(30));

INSERT ALL
INTO prim_tbl VALUES (1,'aad')
INTO prim_tbl VALUES (1,'aads')
INTO prim_tbl VALUES (2,'bb')
INTO prim_tbl VALUES (2,'cc')
INTO prim_tbl VALUES (2,'dd')
SELECT * FROM dual;

I want to select the ids only one time, i.e my output will have only two rows: one row with id as 1 and other row with id 2 whatever be the description.

desired output sample:

Quote:1, aad
2, bb

I used:
select distinct(id),description from prim_tbl;

but it did not give the required result.How can I get it??

View 6 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

Forms :: How To Restrict Update In S Specific Field

Jul 9, 2012

I'm trying to restrict update in a specific field in my form . I have set its property(update allowed) to no and still the field is update able. I am also having on-commit trigger in my form level that well display a message and followed by the command commit. is it possible the trigger is overriding the property(update restriction).

View 9 Replies View Related

Forms :: Continuous Update Of Calculated Field?

Aug 6, 2013

I have seen in probably VB or Dot net software being used at some premises that there "formula computation is live and interactive".

What i means that suppose a cashier has made invoice having total of 83$. Mow in the text box for entering amount received, the cashier is about to enter 100 but surprisingly the returned value/remaining value (total invoice - amount received) is being computer LIVE.

This is what happens.

1) The cashier entered 1 and the remaining value instantly showed 82 (83-1)
2) then on other key stroke of 0 by cashier and then then the remaining value instantly showed 73 (83-10)
3) then on other key stroke of 0 by cashier and then then the remaining value instantly showed 17 (83-100)

Hence a continuous updation/changing of the remaining value on every key stroke is observed.

View 3 Replies View Related

Forms :: Make Field Protected Against Update?

Apr 29, 2011

What i am required to do is to protect a field 'COUR_CODE' from update when the SHIP_METHOD='R'. c

if :system.record_status = 'INSERT' then
declare
vcour_code ACCOUNTS.cour_code%type := NULL;
vcourier_account_no ACCOUNTS.courier_account_no%type := NULL;
canvas_name varchar2(30);
begin

[code]....

View 11 Replies View Related

Summarizing Over Multiple Columns Aggregated On Grouping Field

Aug 9, 2011

I have spent the past hours trying to come up with a query to get the following starting table to the required result table.

STARTING TABLE:

PCD TEL

A 1
A 2
A 3
A 4
A 5
B 2
C 3
C 4

REQUIRED RESULT:

PCD TEL1 TEL2 TEL3 TEL4

A 1 2 3 4
B2 NULL NULL NULL
C 3 4 NULL NULL

View 1 Replies View Related

SQL & PL/SQL :: Concatenate String To Number Field In Update Statement

Oct 4, 2011

I need to concatenate string to the number field in an update statement like this:

update test1 set model_pin = seq_no || '_' || model
where eoc_code like 'AEW%'

When I run this command in sql , I get ERROR at line 1:

ORA-01722: invalid number

View 7 Replies View Related

Application Express :: Update Field On Change For SQL Query

Nov 26, 2012

We are using APEX 4.2, 10GR2, RedHat5.

I have a report that comes from SQL Query (updateable report). I'm using the apex_item.text and apex_item.hidden on fields. I'm using a button to submit and after submit process to add some logic that I need.

There could be 1 - 10 records in the report. There is only 1 field that is needed to enter a value, but the value of this field determines the value of another field. I think that I can do this with a submit button and an after submit process where I loop through all the records. I think I have this handled.

This is the question

When the value of that field is changed then the value of another field in the same row changes immediately. All the examples I've seen so far are for a single record and that doesn't work for us.

I guess this is a MRU process but I haven't seen an example where a dynamic action is possible on a Multi Row Update.

View 4 Replies View Related

Application Express :: How To Update Total - New Value Doesn't Display In Field?

Oct 18, 2012

Let's say that we have an order entry app and the price and quantity items are already populated. We now want to show the user the extended price (the product of the first two items). the extended price would automatically display after both the quantity and price items are entered. I'm assuming that would require some kind of client-side processing. I imagine server-side processing is simpler, so I'll lean in that direction. I'm sure we've all seen web sites that require you to click a button for the order totals to be updated. I'm okay with that approach, but I haven't quite put all of the pieces together. Here's what I came up with.

A region button was added to trigger the updating of the extended price. The button's "Action When Button Clicked" is to submit the page. Under "Page Processing", a process was created to do the calculation with the recipient of the product being a page item. From debug code in the procedure, I can see that the item containing the extended price was, indeed, modified. But the new value doesn't display in the field and the Session window shows that the value of the item didn't change.

I must be missing something. The debug code says the item value was updated. The Session window says it wasn't updated. What gives? What did I do wrong and what needs to be done to correct this?

View 3 Replies View Related

Application Express :: 4.2 - How To Update Field / Column With Sysdate Server Date

Mar 6, 2013

Environment:
Apex 4.2
DB 11gR2

I've started using Apex 4.2(new to Apex). I have built a form based on a table with a date column on it. The form allows update on all fields/columns of the base table. For the date field/column, the goal is to present the user with sysdate on load and update the date with sysdate if the record is changed any of the fields. How can I accomplish this?

View 7 Replies View Related

SQL & PL/SQL :: How To Update Multiple Records

May 6, 2010

I have a table formatted like this

ID|First Name|Second Name
1|X|X
2|X|X
3|X|X
4|X|X

and I want to insert First Name and Second Name records using the ID as the reference. The new data is currently in a .csv file, but I could put them in another table if that's easier.

ID|First Name|Second Name
1|Adam|Adamson
2|Ben|Benson
3|Chris|Christophers
4|Dave|Davidson

I understand how to do individual updates, I want to know how it is possible for me to do this as one query, as I have several thousand records to update.

View 14 Replies View Related

SQL & PL/SQL :: How To Update Multiple Columns

Dec 12, 2011

how to over come this error, because i need to update only 3 columns in the table and iam getting error when iam updating like this

update country1 set cname='japan','usa'
where cid=100,101

ERROR:ORA-01747,INVALID USER.TABLE.COLUMN,TABLE.COLUMN,OR COLUMN
SPECIFICATION

View 6 Replies View Related

SQL & PL/SQL :: Update With Multiple Condition?

May 4, 2011

Suppose I have a table.

SQL> select * from emp;

EMPNO ENAME DEPTNO SAL
---------- ---------- ---------- ----------
1 RN 10 10
3 C 20 40
4 A 10 20
5 B 20 100
6 D 10 11
7 S 30 300
6 rows selected

Now I need to update the table as for all employees will get sal 100 for depetno=10 and employees of deptno=20 will get sal=200. I need to update this with a single query.

View 12 Replies View Related

Running Multiple Update Statements At Once

Feb 1, 2012

It started out pretty simple where I had to update about 40 contacts in the database and I would have 40 separate update statements I would run. The task has jumped to about 300 contacts and I don't want to run 300 update statements. I would like to run this all at once. For example:

update contact
set name = 'Name1'
where row_id = 'row_id1'

update contact
set name = 'Name2'
where row_id = 'row_id2'

update contact
set name = 'Name3'
where row_id = 'row_id3'

My DB is oracle 10, and TOAD is version 9.

View 1 Replies View Related

SQL & PL/SQL :: UPDATE Multiple Fields Without Where Exist

Jun 17, 2011

I'm updating a big table with an other one (see topic

[URL]........

I was wondering if I could do it without using the WHERE EXISTS condition. Let me explain better:

create table TEST
(
ENT_SIG VARCHAR2(10),
EMP_ID VARCHAR2(10),
DATE_START DATE,
DATE_END DATE
);

create table TEST2
(
ENT_SIG VARCHAR2(10),
EMP_ID VARCHAR2(10),
DATE_START DATE,
DATE_END DATE
);

insert into TEST (ENT_SIG, EMP_ID, DATE_START, DATE_END)
values ('014', '120', TO_DATE('20080101','YYYYMMDD'), TO_DATE('20080131','YYYYMMDD'));
insert into TEST (ENT_SIG, EMP_ID, DATE_START, DATE_END)
values ('014', '121', TO_DATE('20080201','YYYYMMDD'), TO_DATE('20080228','YYYYMMDD'));
[code].....

I'm asking if there's a way to do this:

update test a
set (date_Start, date_end) = (select date_start, date_end
from test2 b
where b.emp_id = a.emp_id
[code].......

Without using the WHERE EXISTS. I don't want to make two accesses to table2, I would like instead to do something like "If subquery returns a row, use it, else keep what you have in destination table".

Is there a way to do it without entering test2 twice?

View 10 Replies View Related

SQL & PL/SQL :: Using Cursor To Update Multiple Columns

Oct 22, 2011

I need to write a script which copies 4 col data from one table to another table. there are three tables

cwat_curr_mst and cwat_assigned_customer and cwat_assignment_mst.
Cwat curr mst has PK curr_id and cwat_assigned_customer has PK assignment_id.
Also cwat_assigned_customer has customer_id.
In cwat_assignment_mst has Curr_id and Assignment_ID.

cwat_curr_mst and cwat_assigned_customer tables has 4 cols in common
they are
ASRT_SNM_NO, SNM_NO, FLORIDA_NO, CBRN_NO.

So from curr_mst all these 4 cols data needs to come/copy into cwat_assigned_customer.

View 20 Replies View Related

SQL & PL/SQL :: Update Statement Using Multiple Tables

Aug 26, 2010

I am issuing an update statement in which I am using multiple tables it is giving me an error " set keyword missing"

update E_CONT_DETAIL_NUMB_VALUE ecdnv, y_obj_category yoc, t_contact tc
set ecdnv.ContTPRecCount = 1000
where tc.default_category_id = (select primary_key from y_ojb_category where tree_position = 'CONT')
and ecdnv.detail_field_id=tc.default_category_id;

update E_CONT_DETAIL_NUMB_VALUE ecdnv, y_obj_category yoc, t_contact tc
*
ERROR at line 1:
ORA-00971: missing SET keyword

View 4 Replies View Related

SQL & PL/SQL :: After Update Trigger (with Multiple Tables)

Nov 21, 2012

I have to write a "after update trigger". Here, i have to update the stock table by other inventory tables (by complex query).
I have written trigger below. how to make it correct?

create or replace trigger trg_stk_upd_pur
after update on O_STOCK_EFFECTS
REFERENCING NEW AS new OLD AS old
FOR EACH ROW

[Code]....

View 5 Replies View Related

Select Multiple Images Using Department Field In Spriden Table To Pull Needed Id Numbers

Jan 29, 2009

I have an Oracle 10g database, on the App Serv I have an image file that has 20,000 .jpg files that has an id number as each image name.I have successfully queryed the image file and posted one image to my web page matching the image id number.
sample:

select substr(spriden_last_name,1,20)||', '||
substr(spriden_first_name,1,20)||' '||
substr(spriden_mi,1,1) stname,
'<img src = "/images/&1..JPG" width="400" height="400"/>' pic
from spriden
where spriden_id = '&1'
/

the &1 is the matching id number that is input from the user.My task now is to select multiple images using a department field in the spriden table to pull the needed id numbers.I have not been successful in the proper format to pass the id number to the <img src field.

View 4 Replies View Related







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