220 pts.
 Oracle table update exist ?
dear all, i want implemente a update on many table but i don't know the syntax please help me. My update is at less on 5 table

Software/Hardware used:
ASKED: November 3, 2009  12:36 PM
UPDATED: November 6, 2009  4:03 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

You can’t update more than one table with a single update statement.
Why do you need to do this ?

 63,535 pts.

 

I must do a form who insert, update, delete on five table. I make a first objective who insert in five tables in using insert all and the end add select * from dual
with out problem.
I want update more than table because there are a link between this data. if there are no solution for updating at more table so how implemente a update on my five tables

 220 pts.

 

You can update your five tables with a stored procedure, or in your application.

Without more details about your table structures, the links between them, and how you want to update them, it would be really difficult to provide more help. Please provide more details.

 63,535 pts.

 

i want to show the picture of my database i don’t how i can insert in this

 220 pts.

 

I have found a maner to insert a picture so this database. as you can see i want implemente a update in this table in one clic
gestock

 220 pts.

 

 

 

Ok this the picture at the end so as you can see my 5 table are
Tbl_disk, appartenir, tbl_pack, compatible, tbl_ss_plateforme. yes i want make in one clic a update and delete with form help.
PLease for this patience

 220 pts.

 

We can see the tables, but we don’t know how you want to update them.

In general, you can write one update statement for each table in your click event handler (how to do that will be different depending on the programming language, which you did not specify), or you could write an Oracle stored procedure with the 5 updates and call it from the click handler of your program.

Something like this:

CREATE OR REPLACE PROCEDURE your_procedure (p_new_value in number) IS
BEGIN
	UPDATE table_x SET x_column = p_new_value
	WHERE...
	
	UPDATE table_y SET y_column = p_new_value
	WHERE...
	
	UPDATE ...
	...
END;
 63,535 pts.

 

Ok as MySQL Server there are a simple maner to update many table this the syntax :

update TableOne, TableTwo
set TableOne.field1 = word1, TableTwo.field1 = word2

where TableOne.commonID = TableTwo.commonID

With the case on MySQL server there are no problem also oracle …. @@@ERROR@@@
If you thinks your sintax is good i want try

 220 pts.

 

I don’t there are always a problem when i want post a msg
update TableOne, TableTwo
set TableOne.field1 = TableTwo.fieldX
where TableOne.commonID = TableTwo.commonID

 220 pts.

 

update TableOne, TableTwo
set TableOne.field1 = word1, TableTwo.field =world2
where TableOne.commonID = TableTwo.commonID

 220 pts.

 
update TableOne, TableTwo
    set TableOne.field1 = TableTwo.fieldX
    where TableOne.commonID = TableTwo.commonID
 220 pts.

 

Why, we are the problem when i sent a code

 220 pts.

 

create or replace procedure testproc

begin
update data_admin set first_name = ‘&pval’
where id_admin = 3

update tbl_admin set password = ‘&pval’
where id_user = 14
end;

there a error i don’t know where

 220 pts.

 

Each statement needs to end with a semicolon.

Also, that new value needs to be declared as a parameter of the stored procedure, as shown in the example I posted. The way you have it, it would update your tables with the ‘&pval’ string, literally.

If you get more errors, please post the error messages.

 63,535 pts.

 

please how ?? because when i start my procedure with
execute testproc
the error the procedure created with compilation error

 220 pts.

 

This is the command:

show errors;
 63,535 pts.

 
create or replace PROCEDURE TESTPROC (
  par in VARCHAR2, id_par in NUMBER
) AS 
BEGIN
    UPDATE data_admin set first_name = par WHERE id_admin = id_par;
    UPDATE tbl_admin set login = par WHERE id_user = id_par;
    commit;
  NULL;
END TESTPROC;

this is error
Erreur commençant à la ligne 1 de la commande :
call testproc
Rapport d’erreur :
Erreur SQL : ORA-06576: ceci n’est pas un nom de fonction ou de procédure valide
06576. 00000 – “not a valid function or procedure name”
*Cause: Could not find a function (if an INTO clause was present) or
a procedure (if the statement did not have an INTO clause) to
call.
*Action: Change the statement to invoke a function or procedure

 220 pts.

 

1) Where are you calling this procedure from ?
2) Can you post the instruction you are using to call the procedure ?

Have you tried running it from Sql*Plus this way ?

execute testproc('test',1);
 63,535 pts.

 

no i have just use execute testproc and it’s was finish i thinks

 220 pts.

 

Yes it’s great

 220 pts.

 

And on visual basic how can you call this procedure

 220 pts.