dbTalk Databases Forums  

Writting Trigger

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Writting Trigger in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
KonradWo
 
Posts: n/a

Default Writting Trigger - 11-29-2011 , 06:30 AM






I have table and i dont know how to write trigger to this table

Table:
CREATE TABLE TAB1
(
ID NUMBER(9),
ID2 VARCHAR2(20)
)

Valuses:

INSERT INTO TAB1 VALUES (1,'')
INSERT INTO TAB1 VALUES (2,'')
INSERT INTO TAB1 VALUES (3,'')
INSERT INTO TAB1 VALUES (4,'')

Single update:
UPDATE TAB1
SET
ID2 = ('TEXT' || (SELECT ID FROM TAB1 WHERE ID=1))
WHERE ID=1

I have a question:
How to update whole table based on "Single update" ?

I need help with writeing trigger based on "Single update" to automate this process.

I will be very grateful for your help


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

Reply With Quote
  #2  
Old   
joel garry
 
Posts: n/a

Default Re: Writting Trigger - 11-29-2011 , 11:09 AM






On Nov 29, 4:30*am, "KonradWo" <kon...@a.pl> wrote:
Quote:
I have table and i dont know how to write trigger to this table

Table:
CREATE TABLE TAB1
(
* ID * * *NUMBER(9),
* ID2 * * VARCHAR2(20)
)

Valuses:

INSERT INTO TAB1 VALUES (1,'')
INSERT INTO TAB1 VALUES (2,'')
INSERT INTO TAB1 VALUES (3,'')
INSERT INTO TAB1 VALUES (4,'')

Single update:
UPDATE TAB1
*SET
ID2 = ('TEXT' || (SELECT ID FROM TAB1 WHERE ID=1))
*WHERE ID=1

I have a question:
How to update whole table based on "Single update" ?

I need help with writeing trigger based on "Single update" to automate this process.

I will be very grateful for your help

--------------= *Posted using GrabIt *=----------------
------= *Binary Usenet downloading made easy =---------
-= *Get GrabIt for free fromhttp://www.shemes.com/*=-
It sounds like a singularly bad idea, but I'll just ask, what exactly
are you trying to accomplish? The docs have the syntax.

jg
--
@home.com is bogus.
http://www.theregister.co.uk/2011/11..._0_part_three/

Reply With Quote
  #3  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: Writting Trigger - 11-30-2011 , 04:07 AM



El 29/11/2011 13:30, KonradWo escribió/wrote:
Quote:
I have table and i dont know how to write trigger to this table

Table:
CREATE TABLE TAB1
(
ID NUMBER(9),
ID2 VARCHAR2(20)
)

Valuses:

INSERT INTO TAB1 VALUES (1,'')
INSERT INTO TAB1 VALUES (2,'')
INSERT INTO TAB1 VALUES (3,'')
INSERT INTO TAB1 VALUES (4,'')

Single update:
UPDATE TAB1
SET
ID2 = ('TEXT' || (SELECT ID FROM TAB1 WHERE ID=1))
WHERE ID=1

I have a question:
How to update whole table based on "Single update" ?

I need help with writeing trigger based on "Single update" to automate this process.

Your sample code looks fairly similar to the more obvious and less
convoluted single query:

UPDATE TAB1
SET ID2 = 'TEXT' || ID
WHERE ID=1

.... even this:

UPDATE TAB1
SET ID2 = 'TEXT1'
WHERE ID=1

Other than that, I'm not sure I understand your requirements. Do you
want to write a trigger so every time you update one row all other rows
will receive the same update? Why do you think you need that? What do
you have so far?



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Reply With Quote
  #4  
Old   
KonradWo
 
Posts: n/a

Default Re: Writting Trigger - 11-30-2011 , 06:38 AM



W dniu 2011-11-30 11:07, "Álvaro G. Vicario" pisze:

Quote:
Your sample code looks fairly similar to the more obvious and less
convoluted single query:

UPDATE TAB1
SET ID2 = 'TEXT' || ID
WHERE ID=1

... even this:

UPDATE TAB1
SET ID2 = 'TEXT1'
WHERE ID=1

Other than that, I'm not sure I understand your requirements. Do you
want to write a trigger so every time you update one row all other rows
will receive the same update? Why do you think you need that? What do
you have so far?



Thank You

I find the solution in Oracle documentation


Regards
----------
KonradWo

Reply With Quote
  #5  
Old   
KonradWo
 
Posts: n/a

Default Re: Writting Trigger - 11-30-2011 , 06:39 AM



W dniu 2011-11-29 18:09, joel garry pisze:
Quote:
It sounds like a singularly bad idea, but I'll just ask, what exactly
are you trying to accomplish? The docs have the syntax.

jg
--
@home.com is bogus.
http://www.theregister.co.uk/2011/11..._0_part_three/
Thank You

I find the solution in Oracle documentation


Regards
----------
KonradWo

Reply With Quote
  #6  
Old   
Gerard H. Pille
 
Posts: n/a

Default Re: Writting Trigger - 12-01-2011 , 03:17 PM



KonradWo wrote:

Quote:
Thank You

I find the solution in Oracle documentation


Regards
----------
KonradWo

Thank you for greatly increasing the value of this group.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.