Updating one table with colum of another one
Oracle 11g
Hi,
i'im trying to update two colums from SUPPORT (SUPPORT_X, SUPPORT_Y) table with two colums of POST_HTA_BT( POSTHTABT_GPS_X, POSTHTABT_GPS_Y ) table
Understand that the two tables have the colum below:
SUPPORT(SUPPORT_ID,SUPPORT_PLAQUE,POSTHTABT_ID,SUPPORT_X, SUPPORT_Y,....)
POST_HTA_BT (POSTHTABT_ID,POSTHTABT_GPS_X, POSTHTABT_GPS_Y,..)
The SUPPORT_PLAQUE has the varachar type. Except the keys, other colums are varchar type in the two tables.
The point here is to update the support_x, support_y with posthtabt_gps_x and posthtabt_gps_y.But before update we must cheik if the fifth number of support plaque is a character number between "0" to "9' and if the rest of the caracter of the support_plaque is '00000'
Please note that the support_plaque is stored in the table with the form: "0025800000"!!!
So i did the script below i'm trying to execute in sql developper.
SET SERVEROUTPUT ON
DECLARE
chiffre_liste varchar(200):= '0','1','2','3','4','5','6','7','8','9';
CURSOR CUR_GPS_SUPPORT IS
select SUPPORT.SUPPORT_X,SUPPORT.SUPPORT_Y,POSTE_HTA_BT.POSTHTABT_ID,SUPPORT.EXPL_ID,
SUPPORT.SUPPORT_PLAQUE,POSTHTABT_GPS_X,POSTHTABT_GPS_Y
from SUPPORT,
POSTE_HTA_BT
where
SUPPORT.SUPPORT_X IS NULL and
SUPPORT.SUPPORT_Y IS NULL and
SUPPORT.POSTHTABT_ID = POSTE_HTA_BT.POSTHTABT_ID and
SUPPORT.EXPL_ID = POSTE_HTA_BT.EXPL_ID
order by SUPPORT.POSTHTABT_ID;
w_POSTHTABT_ID POSTE_HTA_BT.POSTHTABT_ID%type;
w_SUPPORT_X SUPPORT.SUPPORT_X%TYPE;
w_SUPPORT_Y SUPPORT.SUPPORT_Y%TYPE;
w_EXPL_ID SUPPORT.EXPL_ID%TYPE;
w_SUPPORT_PLAQUE SUPPORT.SUPPORT_PLAQUE%TYPE;
w_POSTHTABT_GPS_X POSTE_HTA_BT.POSTHTABT_GPS_X%TYPE;
w_POSTHTABT_GPS_Y POSTE_HTA_BT.POSTHTABT_GPS_Y%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE('Chargement des coordoonnées GPS -Mise à jour Coord GPS des supports de Départ');
FOR CUR IN CUR_GPS_SUPPORT LOOP
w_POSTHTABT_ID := cur.POSTHTABT_ID;
w_SUPPORT_PLAQUE := cur.SUPPORT_PLAQUE;
w_SUPPORT_X := cur.SUPPORT_X;
w_SUPPORT_Y := cur.SUPPORT_Y;
w_POSTHTABT_GPS_X := cur.POSTHTABT_GPS_X;
w_POSTHTABT_GPS_Y := cur.POSTHTABT_GPS_X;
if substr(cur.support_plaque,5,1) in chiffre_liste and substr(cur.support_plaque,6,5)='00000'
w_SUPPORT_X := CUR.POSTHTABT_GPS_X
w_SUPPORT_Y := CUR.POSTHTABT_GPS_Y
END if;
EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X := NULL and w_SUPPORT_Y := NULL;
END;
--Update de la table des supports
update SUPPORT
set SUPPORT_X = w_SUPPORT_X,
SUPPORT_Y = w_SUPPORT_Y
where SUPPORT_PLAQUE = w_SUPPORT_PLAQUE;
-- On valide imm?diatement
commit;
EXCEPTION when no_data_found then null;
-- Pas de coordonnées trouvées
END;
END;
and i got the following errors:
Rapport d'erreur :
ORA-06550: Line 2, colum 34 :
PLS-00103: Symbole "," rencontré à la place d'un des symboles suivants :
* & = - + ; < / > at in is mod remainder not rem
<exposant (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
ORA-06550: Ligne 2, colonne 52 :
PLS-00103: Symbole ";" rencontré à la place d'un des symboles suivants :
) , * & = - + < / > at in is mod remainder not rem =>
<exposant (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member subm
ORA-06550: Line 38, colum 48 :
PLS-00103: Symbole "CHIFFRE_LISTE" rencontré à la place d'un des symboles suivants :
Symbole "(" a été substitué à "CHIFFRE_LISTE" pour continuer.
ORA-06550: Line 39, colum 12 :
PLS-00103: Symbole "W_SUPPORT_X" rencontré à la place d'un des symboles suivants :
) , * & - + / at mod remainder rem <exposant (**)> and or ||
multiset
ORA-06550: Line 40, colum 12 :
PLS-00103: Symbole "W_SUPPORT_Y" rencontré à la place d'un des symboles suivants :
. ( ) , * @ % & = - + < / > at in is mod remainder not rem
<exposant (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || mult
ORA-06550: Line 41, colum 9 :
PLS-00103: Symbole "END" rencontré à la place d'un des symboles suivants :
. ( ) , * @ % & = - + < / > at in is mod remainder not rem
<exposant (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset memb
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
I verified the line number, but don't see the error in my code.
Please could you help me?
peace
Here the new script
SET SERVEROUTPUT ON
DECLARE
TYPE chiffre_liste IS TABLE OF VARCHAR2(10);
my_list chiffre_liste;
CURSOR CUR_GPS_SUPPORT IS
select SUPPORT.SUPPORT_X,SUPPORT.SUPPORT_Y,POSTE_HTA_BT.POSTHTABT_ID,SUPPORT.EXPL_ID,
SUPPORT.SUPPORT_PLAQUE,POSTHTABT_GPS_X,POSTHTABT_GPS_Y
from SUPPORT,
POSTE_HTA_BT
where
SUPPORT.SUPPORT_X IS NULL and
SUPPORT.SUPPORT_Y IS NULL and
SUPPORT.POSTHTABT_ID = POSTE_HTA_BT.POSTHTABT_ID and
SUPPORT.EXPL_ID = POSTE_HTA_BT.EXPL_ID
order by SUPPORT.POSTHTABT_ID;
w_POSTHTABT_ID POSTE_HTA_BT.POSTHTABT_ID%TYPE;
w_SUPPORT_X SUPPORT.SUPPORT_X%TYPE;
w_SUPPORT_Y SUPPORT.SUPPORT_Y%TYPE;
w_EXPL_ID SUPPORT.EXPL_ID%TYPE;
w_SUPPORT_PLAQUE SUPPORT.SUPPORT_PLAQUE%TYPE;
w_POSTHTABT_GPS_X POSTE_HTA_BT.POSTHTABT_GPS_X%TYPE;
w_POSTHTABT_GPS_Y POSTE_HTA_BT.POSTHTABT_GPS_Y%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE('Chargement des coordoonnées GPS -Mise à jour Coord GPS des supports de Départ');
my_list := chiffre_liste('0','1','2','3','4','5','6','7','8','9');
FOR CUR IN CUR_GPS_SUPPORT LOOP
w_POSTHTABT_ID := cur.POSTHTABT_ID;
w_SUPPORT_PLAQUE := cur.SUPPORT_PLAQUE;
w_SUPPORT_X := cur.SUPPORT_X;
w_SUPPORT_Y := cur.SUPPORT_Y;
w_POSTHTABT_GPS_X := cur.POSTHTABT_GPS_X;
w_POSTHTABT_GPS_Y := cur.POSTHTABT_GPS_X;
if substr(cur.support_plaque,5,1) in (my_list) then
if substr(cur.support_plaque,6,5)='00000' then
w_SUPPORT_X := CUR.POSTHTABT_GPS_X;
w_SUPPORT_Y := CUR.POSTHTABT_GPS_Y;
End if;
END if;
--EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X,w_SUPPORT_Y := NULL ;
--END;
--Update de la table des supports
update SUPPORT
set SUPPORT_X = w_SUPPORT_X,
SUPPORT_Y = w_SUPPORT_Y
where SUPPORT_PLAQUE = w_SUPPORT_PLAQUE;
-- On valide imm?diatement
commit;
--EXCEPTION when no_data_found then null;
--Pas de coordonnées trouvées
--END;
END LOOP;
END;
And i got the error:
Rapport d'erreur :
ORA-06550: Ligne 40, colonne 12 :
PLS-00383: non-concordance de type détectée à 'SUBSTR' dans une clause IN ou NOT IN
ORA-06550: Ligne 40, colonne 9 :
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
I think to do a loop with your i idea, something like this:
DECLARE
TYPE liste_1 IS TABLE OF NUMBER INDEX BY VARCHAR2(10);
my_list liste_1;
Begin
my_list('0') := 1;
my_list('1') := 1;
my_list('2') := 1;
my_list('3') := 1;
my_list('4') := 1;
my_list('5') := 1;
my_list('6') := 1;
my_list('7') := 1;
my_list('8') := 1;
my_list('9') := 1;
for i in my_list loop
if substr(cur.support_plaque,5,1) in my_list(i) then
if substr(cur.support_plaque,6,5)='00000' then
w_SUPPORT_X := CUR.POSTHTABT_GPS_X;
w_SUPPORT_Y := CUR.POSTHTABT_GPS_Y;
End if;
End if;
End loop
END;
What do you think?
Similar Messages
-
How to update this table with values from another table ?
Hi
I have a table "regies". I want to replace the values of the column "regies.agent" by the value of the column "regies_personnes.id"
As you see the tables have a common values column. ie regies.agent = regies_personnes.nom
Table "regies" :
Insert into "regies" (AGENT) values ('Humberdot Alain');
Insert into "regies" (AGENT) values ('Danard Patrick');
Table "regies_personnes" :
Insert into REGIES_PERSONNES (NOM,ID) values ('Humberdot Alain',1);
Insert into REGIES_PERSONNES (NOM,ID) values ('Danard Patrick',2);
Before we have this
sql>select agent from regies ;
Humberdot Alain
Danard Patrick
After the update, the result should be
sql>select agent from regies ;
1
2
Thank you for your kind answer.You will face error if you have duplicates
ORA-01427 Single row subquery returns Multiple rows.Try this way
create table regies(agent varchar2(30));
create table regies_personnes( nom varchar2(30),id number);
Insert into regies (AGENT) values ('Humberdot Alain');
Insert into regies (AGENT) values ('Danard Patrick');
Insert into REGIES_PERSONNES (NOM,ID) values ('Humberdot Alain',1);
Insert into REGIES_PERSONNES (NOM,ID) values ('Danard Patrick',2);
Insert into regies (AGENT) values ('Humberdot Alain');
Insert into regies (AGENT) values ('Danard Patrick');
Insert into REGIES_PERSONNES (NOM,ID) values ('Humberdot Alain',1);
Insert into REGIES_PERSONNES (NOM,ID) values ('Danard Patrick',2);
commit;
update regies r set agent = (select id from regies_personnes p where r.agent = p.nom
and rownum=1)
where exists (select id from regies_personnes p where r.agent = p.nom
commit -
Update a table with data from another table
Hi to All,
I have in my 'schema' 2 tables:
CREATE TABLE T_ITEMS
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE TABLE T_PRICES
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
I need to create a script that for each record in T_ITEMS, read if exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update ITEM_PRICE in T_ITEMS.
Can anyone help me?
Thank You and Best Regards
GaetanoMERGE INTO T_ITEMS B USING (
SELECT
ITEM_GROUP ,
ITEM_CODE,
ITEM_PRICE
FROM T_PRICES) E
ON (B.ITEM_CODE= E.ITEM_CODE)
WHEN MATCHED THEN
UPDATE SET B.ITEM_PRICE= E.ITEM_PRICE
WHEN NOT MATCHED THEN
INSERT (ITEM_GROUP ,
ITEM_CODE,
ITEM_DESCRIPTION ,
ITEM_QTA ,
ITEM_PRICE )
VALUES (E.ITEM_GROUP,
E.ITEM_CODE,
'UNKNOWN',
'UNKNOWN',
E.ITEM_PRICE);
COMMIT; -
Updating a table with data from another table with joins involving 3 other
update party_relship pr
set pr.COMMENT_TEXT = temp.notes
from party p,
party p1,
party_reference pref,
TEMP_DEPT_NOTE temp
where pr.FROM_PARTY_ID = p.PARTY_ID
and p.CMA_CUSTOMER_NUMBER = temp.cma_num
and pr.TO_PARTY_ID = p1.PARTY_ID
and p1.PARTY_ID = pref.PARTY_ID
and pref.REFERENCE_VALUE = temp.deptnum
ORA-00933: SQL command not properly ended
What is the problem here.
Thanks !There are a few issues here 1) no from clause is directly part of the update stmt,
2) temp.notes is not available directly
I am not 100% sure this update is correct since I am selecting temp.notes using the same query as the in the where clause but I wanted to show the complete syntax. Basically if you need to limit the number of updates done then change the select that is part of the exists clause, if you need to change the way the pr.comment_text is being set then to need to change the sub_query.
update party_relship pr
set pr.comment_text =
(select temp.notes
from party p,
party p1,
party_reference pref,
temp_dept_note temp
where pr.from_party_id = p.party_id
and p.cma_customer_number = temp.cma_num
and pr.to_party_id = p1.party_id
and p1.party_id = pref.party_id
and pref.reference_value = temp.deptnum)
where exists(select 1
from party p,
party p1,
party_reference pref,
temp_dept_note temp
where pr.from_party_id = p.party_id
and p.cma_customer_number = temp.cma_num
and pr.to_party_id = p1.party_id
and p1.party_id = pref.party_id
and pref.reference_value = temp.deptnum)Message was edited by:
Bob C -
UPDATING A TABLE WITH SAME INFO FROM ANOTHER TABLE ON THE SAME DB
0down votefavorite
I am trying to update a table with info from another table on the same db with same table name. I just want the info to be the same , no primary key or constraint involve just a straight replacement of records and I keep getting errors WITH THE TABLE not
being recignize. below is my query:
UPDATE
VNDFIL
SET EOBTYP
= VNDFIL.EOBTYP,
EDI_X12_835_VERSION = VNDFIL.EDI_X12_835_VERSION
FROM
AGERECOVERY
WHERE
VNDFIL.EOBTYP
= VNDFIL.EOBTYP
AND
VNDFIL
.EDI_X12_835_VERSION
= VNDFIL.EDI_X12_835_VERSIONHi rotary,
If those two same named tables are in the same database then they have to be in different schemas. If you mean they are in the same server instance, then they may be in different databases, besides the "table not being recognized" error,
anyway you should use the fully qualified table names, that is database.Schema.Table(If across instances, ServerName should be prefixed) to avoid the table unrecognized error.
Using Identifiers As Object Names
With the fully qualified names, your update statement can be like below.
UPDATE
db1.schema1.VNDFIL
SET EOBTYP = srcTbl.EOBTYP, EDI_X12_835_VERSION = srcTbl.EDI_X12_835_VERSION
FROM
db1.schema2.VNDFIL srcTbl
WHERE
db1.schema1.VNDFIL.EOBTYP = srcTbl.VNDFIL.EOBTYP AND
db1.schema1.VNDFIL.EDI_X12_835_VERSION = srcTbl.VNDFIL.EDI_X12_835_VERSION
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Create a sales order with reference to another one. (BAPI)
Hi everybody,
I'm trying to create a new sales order with reference to another one (That's important because of the documents flow).
I'm using 'BAPI_SALESORDER_CREATEFROMDAT2' but I couldn´t do it yet. I've read some ideas about this kind of creation in this forum; but I still haven´t found the solution yet.
Some ideas about the BAPI parameters I nedd to complete?
Thanks in advance!!Hi,
Go through this one
*& Report ZSD_R_SALESORDER
report zsd_r_salesorder1 line-size 132 message-id zmmbapi .
*& Created By : shailaja
*& Created on : 13.10.2007
*& Requested By : vardhman
*& Description of program :
Internal table definition *
data: gt_order_header_in like bapisdhead occurs 0 with header line,
gt_return like bapireturn1 occurs 0 with header line, " Return Messages
gt_order_items_in like bapiitemin occurs 0 with header line, " Item Data
gt_salesdocument like bapivbeln-vbeln , "Number of Generated Document
gt_order_partners like bapiparnr occurs 0 with header line, "Document Partner
gt_return1 like bapiret2 occurs 0 with header line.
Data definition *
types: begin of ty_gt_ft_sales ,
partn_numb(10) type n ,"Customer Number 1
partn_role(2) ,"Partner function
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
material(18), "MATERIAL
targetquantity(020),"Target quantity
reqqty(020), "Req quantity
reqdate(010), "req date
*REQ_DATE_H(010),
ref_1(012), "Ref
unload_pt(025),
*PARTN_ROLE(2) ,"Partner function
*PARTN_NUMB(10) ,"Customer Number 1
end of ty_gt_ft_sales,
begin of ty_header ,
partn_numb(10) ,"Customer Number 1
partn_role(2) ,"Partner function
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
unload_pt(025),
req_date_h(010),
end of ty_header,
begin of ty_item,
material(18), "MATERIAL
targetquantity(020),"Target quantity
reqqty(020), "Req quantity
reqdate(010), "req date
ref_1(012), "Ref
*UNLOAD(025),
end of ty_item.
data : msg(240) type c, " Return Message
e_rec(8) type c, " Error Records Counter
rec_no(8) type c, " Records Number Indicator
s_rec(8) type c, " Successful Records Counter
t_rec(8) type c, " Total Records Counter
v_matnr like mara-matnr,
v_parvw type parvw.
data : gt_ft_sales type standard table of ty_gt_ft_sales with header line.
data : wa_gt_ft_sales type ty_gt_ft_sales,
wa_order_items_in like gt_order_items_in,
wa_gt_ft_sales1 type ty_gt_ft_sales,
wa_header type ty_header,
salesdocument like bapivbeln-vbeln.
selection block for EXCEL UPLOAD FILE
selection-screen begin of block b1 with frame title text-000.
parameters file type ibipparms-path obligatory.
selection-screen end of block b1.
*<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
at selection-screen on value-request for file .
perform getname.
form getname.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
importing
file_name = file.
endform.
*TOP-OF-PAGE.
top-of-page.
skip 3.
format color col_heading inverse on.
write 40 text-001.
format color col_heading inverse off.
skip 1.
format color col_negative inverse on.
write :/ text-002, 13 sy-mandt , 104 text-003, 121 sy-uname,
/ text-004, 13 sy-datum , 104 text-005, 121 sy-uzeit.
format color col_negative inverse off.
skip 3.
*START-OF-SELECTION.
start-of-selection.
perform get_data.
perform bapi.
*end-of-page.
perform result.
form result.
t_rec = e_rec + s_rec.
skip 3.
format color col_total inverse on.
write: /38 text-007, t_rec.
format color col_total inverse off.
format color col_negative inverse on.
write: /38 text-008, e_rec.
format color col_negative inverse off.
format color col_total inverse on.
write: /38 text-009, s_rec.
format color col_total inverse off.
endform.
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
call function 'WS_UPLOAD' "#EC *
exporting
filename = file
filetype = 'DAT'
tables
data_tab = gt_ft_sales
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11.
if sy-subrc 0 .
message e000.
endif.
endform. " get_data
*& Form BAPI
form bapi .
loop at gt_ft_sales into wa_gt_ft_sales.
wa_gt_ft_sales1 = wa_gt_ft_sales.
at new partn_numb.
wa_header-doc_type = wa_gt_ft_sales1-doc_type..
wa_header-sales_org = wa_gt_ft_sales1-sales_org . "'0001'
wa_header-distr_chan = wa_gt_ft_sales1-distr_chan. "'01'
wa_header-division = wa_gt_ft_sales1-division. " '01'
wa_header-purch_no = wa_gt_ft_sales1-purch_no.
wa_header-req_date_h = wa_gt_ft_sales1-reqdate.
call function 'CONVERSION_EXIT_PARVW_INPUT'
exporting
input = wa_gt_ft_sales1-partn_role
importing
output = v_parvw.
wa_header-partn_role = v_parvw.
wa_header-partn_numb = wa_gt_ft_sales1-partn_numb.
wa_header-unload_pt = wa_gt_ft_sales1-unload_pt.
move-corresponding wa_header to gt_order_partners.
move-corresponding wa_header to gt_order_header_in.
append gt_order_header_in.
append gt_order_partners.
endat.
call function 'CONVERSION_EXIT_CCMAT_INPUT'
exporting
input = wa_gt_ft_sales1-material
importing
output = v_matnr.
gt_order_items_in-material = v_matnr .
gt_order_items_in-target_qty = wa_gt_ft_sales1-targetquantity . "'1000'
gt_order_items_in-req_qty = wa_gt_ft_sales1-reqqty.
gt_order_items_in-req_date = wa_gt_ft_sales1-reqdate.
*GT_ORDER_ITEMS_IN-BILL_DATE = wa_GT_FT_SALES1-REQDATE.
gt_order_items_in-ref_1 = wa_gt_ft_sales1-ref_1.
append gt_order_items_in.
clear : wa_gt_ft_sales1,wa_header.
at end of partn_numb.
call function 'BAPI_SALESORDER_CREATEFROMDAT1'
exporting
order_header_in = gt_order_header_in
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = 'X'
importing
salesdocument = salesdocument
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
return = gt_return
tables
order_items_in = gt_order_items_in
order_partners = gt_order_partners.
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX =
if gt_return-type eq 'E' .
e_rec = e_rec + 1.
read table gt_return with key id = 'V1'.
format color col_negative inverse on.
rec_no = e_rec + s_rec.
concatenate text-006 rec_no ':'
gt_return-message into msg separated by space .
condense msg.
write: / msg.
format color col_negative inverse off.
elseif gt_return-number = '000'.
s_rec = s_rec + 1.
format color col_positive inverse on.
msg = 'SUCCESS'.
condense msg.
write: / msg .
format color col_positive inverse off.
write :/ salesdocument, 'Has been created'.
perform commit_mm.
endif.
clear: gt_return[], msg.
endat.
endloop.
endform. " SLALE_UPLOAD_DATA
*& Form COMMIT_MM
text
--> p1 text
<-- p2 text
form commit_mm .
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = gt_return1.
clear: gt_order_items_inhttp://].\"GT_ORDER_CONDITIONS_IN[.
endform. " COMMIT_MM
inthis pass re_doc field in header...
Edited by: Naresh kumar -
Create an order using BAPI with reference to another one.
Hi everybody,
I'm trying to create a new sales order with reference to another one (That's important because of the documents flow).
I'm using 'BAPI_SALESORDER_CREATEFROMDAT2' but I couldn´t do it yet. I've read some ideas about this kind of creation in this forum; but I still haven´t found the solution yet.
Some ideas about the BAPI parameters I nedd to complete?
Thanks in advance!!
Edited by: Ole ES on Sep 11, 2008 12:32 PMHi,
Are you sure you can create a sales order with reference to ANOTHER sales order? The reason I ask is that in the front end, sales orders are created with reference to either quotations or contracts. There are settings known as "copying control" that need to be maintained for this to show up as document flow.
We have been working on a BAPI to create a sales order, but that is without reference to another document, and it works fine.
Could you please elaborate?
Cheers. -
Updating base table with Materialized View's data
Hi,
In order to update base table with MVs data, I am trying real time data transfer between two databases. One is Oracle 8i and other is Oracle 9i. I have created an updatable MV in 9i on a base table using database link. The base table is in 8i. Materialized View log is created in 8i on base table. MV has to be associated to some replication group, but I am not able to create replication group in 9i to which MV has to be associated. The required packages are not installed.
Replication packages are to be used to create replication group are :
/*Create Materialized View replication group*/
BEGIN
DBMS_REPCAT.CREATE_MVIEW_REPGROUP (
gname => 'TEST_MV_GRP',
master => 'TEST_DATA_LINK',
propagation_mode => 'ASYNCHRONOUS');
END;
But above block is giving error.
Can anyone suggest how to resolve this, or are there any other approaches (by not using replication packages) to update base table with MVs data ?
Thanks,
ShaileshYes, I created link between two databases and was able to update tables on 8i from 9i database using that link.
The error I am getting while creating replication group is :
ORA-06550
PLS-00201 : identifier 'SYS.DBMS_REPCAT_UTL2@'TEST_DATA_LINK' must be declared
ORA-06550
PLS-00201 : identifier 'SYS.DBMS_REPCAT_UNTRUSTED@'TEST_DATA_LINK' must be declared
ORA-06512 : at "SYS.DBMS_REPCAT_UTL", line 2394
ORA-06512 : at "SYS.DBMS_REPCAT_SNA_UTL", line 1699
ORA-06512 : at "SYS.DBMS_REPCAT_SNA", line 64
ORA-06512 : at "SYS.DBMS_REPCAT", line 1262
Is there any other approach which can be used to update base table with MVs data instead of using replication packages ?
Thanks,
Shailesh -
Updating a table with billion rows
It was an interview question, what's the best way to update a table with 10 billion rows. Give me your suggestions. Thanks in advance.
svkThe best way to answer questions such as this is NOT with a absolute and specific answer. Instead, discuss your strategy for approaching the problem. The first step is to understand your exact requirement. It is surprising how often people
write update statements with an under-qualified where clause. NEVER update a row that does not need to be updated. For example, a statement like:
update mytable set cola = 'ABC' where id in (1, 45, 212);
Assuming id is unique for the table and the specified values exist in the table, we know 3 rows will be updated. Do all of those rows need to be updated? Think about it. If cola is already set to 'ABC' for any of those rows, we could ignore
those rows and make the update more efficient. To do that, you need to add "and cola <> 'ABC' " to the where clause. That is just one example of understanding exactly what you need to do - and doing only that which needs to be done.
Once you understand exactly what you need to do, you need to analyze the impact of the update and identify any potential issues. Updating a lot of rows can take a lot of time and consume large amounts of log and disk space. What else is using
the table? Can you afford to lock the table for the duration of the update? Are there concurrency issues, regardless of whether you update in batches or in one single statement? When using a batch approach, is there an issue if someone runs
a query against the table (i.e., the result is different from that of the same query run after all updates have been completed)? Are you changing something which is included in an index? Are you changing part of the clustered index?
Ultimately, every question you are asked is (or should be) designed to test your problem-solving skills and your skillset. IMO, it is relatively easy to improve your skillset of any particular tool, language, or environment. The other - not so much
and that is why they are more valuable IMO. -
Recordset - updating 2 tables with 1 recordset using application object update record
I have a recordset that uses a field from 2 different tables
with a select statement where clause that joins a userid. I can
display the field’s data just fine. Now I want to use the
Application object “update record” so I can modify
either of the fields. The problem is the Application object
“update record” only allows you to update one table.
How does Dreamweaver mx 2004 allow me to update 2 tables with one
recordset and 1 submit button? Currently using php.
Example of where:
Where member.userid = member_detail.userid
I tried creating the one form with the field from the first
table and that works just fine. I added the other field from the
other table into the form but ofcourse there isn’t any code
that will update the second table so it won’t work.
My application requires me to update alot of fields between 2
tables at the same time.
Does anyone know a way using Dreamweaver mx 2004 to do this?
I don’t have much php experience.jon-rookie wrote:
> DreamerJim,
>
> I am sorry but I don't think you are correct. I just
can't believe that with
> all the powers to be at Macromedia and now Adobe can't
figure out how to update
> two tables at once. There are millions of db's out there
that require this. I
> spent several hours today perusing lots of posts on the
internet. It seems I
> am not the only one out there that has asked this
question. Unfortunately
> there are no good answers yet to my surprise.
>
> I did find a Dreamweaver extension that does exactly
what I myself and many
> others want. The problem is it is no longer available
unless you purchase a
> bundle of software from Adobe.
>
> I have not looked into it in detail so I am not 100%
sure that is accurate!
>
> Still, alot of php programmers do this all the time
without much trouble. I
> just want to know if Dreamweaver mx 2004 has the
capability if a person knows
> the right steps.
>
> Hopefully a Dreamweaver expert will post something to
let us know for sure.
> Until then I am stuck.
>
Not even CS3 has this built in, you will either have to code
it yourself
or buy the extension you have found. Dreamweaver gives you
basic
features to help you develop applications, but if you want to
do
anything really clever you have to do it yourself.
One thing to consider is maybe creating an SQL view that is
can be
updated. I am pretty sure it exists, then you use the view
instead of
the table in the update behaviour. I have never done it
myself, but I am
sure it can be done.
Steve -
Best way to update a table with disinct values
Hi, i would really appreciate some advise:
I need to reguarly perform a task where i update 1 table with all the new data that has been entered from another table. I cant perform a complete insert as this will create duplicate data every time it runs so the only way i can think of is using cursors as per the script below:
CREATE OR REPLACE PROCEDURE update_new_mem IS
tmpVar NUMBER;
CURSOR c_mem IS
SELECT member_name,member_id
FROM gym.members;
crec c_mem%ROWTYPE;
BEGIN
OPEN c_mem;
LOOP
FETCH c_mem INTO crec;
EXIT WHEN c_mem%NOTFOUND;
BEGIN
UPDATE gym.lifts
SET name = crec.member_name
WHERE member_id = crec.member_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
IF SQL%NOTFOUND THEN
BEGIN
INSERT INTO gym.lifts
(name,member_id)
VALUES (crec.member_name,crec.member_id);
END;
END IF;
END LOOP;
CLOSE c_mem;
END update_new_mem;
This method works but is there an easier (faster) way to update another table with new data only?
Many thanks>
This method works but is there an easier (faster) way to update another table with new data only?
>
Almost anything would be better than that slow-by-slow loop processing.
You don't need a procedure you should just use MERGE for that. See the examples in the MERGE section of the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm
MERGE INTO bonuses D
USING (SELECT employee_id, salary, department_id FROM employees
WHERE department_id = 80) S
ON (D.employee_id = S.employee_id)
WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
DELETE WHERE (S.salary > 8000)
WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
VALUES (S.employee_id, S.salary*.01)
WHERE (S.salary <= 8000); -
URGENT update a table with a text that has a single quote in it
Hello, I am trying to update a table with a text that has a single quote in it. I believe I need to use two singles quotes but I am not sure how.
For example:
UPDATE TEST
SET DESCRLONG='Aux fins d'exportations'
WHERE etc...
Should I put 2 singles quotes before the quote in the text?
UPDATE TEST
SET DESCRLONG='Aux fins d'''exportations'
WHERE etc...
Thank you very much :)The best way depends on the version of Oracle.
But, the quick and universal answer is to use two single quotes
SQL> connect test/test
Connected.
SQL> create table test (descrlong varchar2(128));
Table created.
SQL> insert into test values ('This is a string with a '' single quote');
1 row created.
SQL> select * from test;
DESCRLONG
This is a string with a ' single quote
SQL> update test set descrlong='Aux fins d''exportations'
2 where descrlong like 'T%';
1 row updated.
SQL> select * from test;
DESCRLONG
Aux fins d'exportations
SQL> -
How to find table with colum that not support by data pump network_link
Hi Experts,
We try to import a database to new DB by data pump network_link.
as oracle statement, Tables with columns that are object types are not supported in a network export. An ORA-22804 error will be generated and the export will move on to the next table. To work around this restriction, you can manually create the dependent object types within the database from which the export is being run.
My question, how to find these tables with colum that that are object types are not supported in a network export.
We have LOB object and oracle spital SDO_GEOMETRY object type. our database size is about 300G. nornally exp will takes 30 hours.
We try to use data pump with network_link to speed export process.
How do we fix oracle spital users type SDO_GEOMETRY issue during data pump?
our system is 32 bit window 2003 and 10GR2 database.
Thanks
Jim
Edited by: user589812 on Nov 3, 2009 12:59 PMHi,
I remember there being issues with sdo_geometry and DataPump. You may want to contact oracle support with this issue.
Dean -
Is it possible to update multiple tables with a dynamic form?
I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?
I meant
SXMSMSTAT
SXMSSYERR
Thanks. -
How can I update the table with a single query for...
I have a table with columns C1 and C2.
C1 C2
A1 null
A1 null
A1 null
A1 null
A2 null
A2 null
A2 null
A3 null
A4 null
A4 null
I want to update my table with a single query so that I would have data like
C1 C2
A1 1
A1 2
A1 3
A1 4
A2 1
A2 2
A2 3
A3 1
A4 1
A4 2
The updated column C2 has the values like serial no grouped on the column C1.SQL> create table mytable
2 ( c1 varchar2(2)
3 , c2 number(2)
4 )
5 /
Tabel is aangemaakt.
SQL> insert into mytable (c1)
2 select 'A1' from dual union all
3 select 'A1' from dual union all
4 select 'A1' from dual union all
5 select 'A1' from dual union all
6 select 'A2' from dual union all
7 select 'A2' from dual union all
8 select 'A2' from dual union all
9 select 'A3' from dual union all
10 select 'A4' from dual union all
11 select 'A4' from dual
12 /
10 rijen zijn aangemaakt.
SQL> select * from mytable
2 /
C1 C2
A1
A1
A1
A1
A2
A2
A2
A3
A4
A4
10 rijen zijn geselecteerd.
SQL> merge into mytable t1
2 using (select c1
3 , row_number() over (partition by c1 order by null) rn
4 , rowid rid
5 from mytable
6 ) t2
7 on (t1.rowid = t2.rid)
8 when matched then
9 update set c2 = rn
10 when not matched then
11 insert values (null,null)
12 /
10 rijen zijn samengevoegd.
SQL> select * from mytable
2 /
C1 C2
A1 1
A1 2
A1 3
A1 4
A2 1
A2 2
A2 3
A3 1
A4 1
A4 2
10 rijen zijn geselecteerd.Regards,
Rob.
Maybe you are looking for
-
How can i share my iTunes between my iMac and a pc with auth going on the web
i like to share my iTunes as home sharing with my iMac 27 inch late 2009 processor 2.8 ghz os x yosemite 10.10 and a Asus laptop window8 with auth using iCloud
-
Creative Cloud is just circling in my menu bar (10.9.3)
I am trying to download a trial of photoshop, so this is my first install and it just sits and spins.
-
Battery Life is Very Short Recently
Hi, my MacBook Pro battery life has been really dying quickly in the past couple weeks. My MacBook Pro is new as of December, and has only gone through 107 cycles. I am only running Chrome and Microsoft Word and a couple of other applications (Mail a
-
Home network connection question
Why do you suppose that I'm always prompted for my password when I get on my home network? Same network, same password, etc. the only difference is that this didn't start until I switched from Tiger to Leopard.
-
The use of "super" in a constructor
Hi, I am wondering what using "super();" in a constructor does. I've seen this used in may other people's code and I simply don't understand what that line would do. Thanks for your advice.