TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   Where to use "signal" keyword in SQL ? (http://forums.techarena.in/software-development/1161577.htm)

Balgovind 15-04-2009 12:51 PM

Where to use "signal" keyword in SQL ?
 
hello,

I want to ask that where do we use the keyword called " signal " in SQL ? and what is the importance of this keyword ? I am sure many of you would be very well aware of this......can anybody help me with this ?
thnx

Praetor 15-04-2009 12:58 PM

Re: Where to use "signal" keyword in SQL ?
 
SIGNAL -
With the SIGNAL statement, you can use it to raise an SQLSTATE exception. This statement can only be used within a trigger_body or within the body of an SQL routine, whose language type is SQL.
This statement will cause an SQLSTATE exception to be thrown and propagated back to your program.
You provide the text of the message.

NOTE: The SIGNAL statement rolls back the specific event that activated its trigger and all the changes caused by the trigger, as well as the original SQL statement of the user, which includes all the triggers and cascading actions that it invoked.

Syntax -
signal - The SIGNAL keyword is required as the first word in a SIGNAL statement.

sqlstate_message - The sqlstate_message is an SQL string literal value. You can specify any text they would like. The actual SQLSTATE code will be ZG014 and the SQL error code is 25014.

MindSpace 15-04-2009 01:02 PM

Re: Where to use "signal" keyword in SQL ?
 
The signal keyword is specified under the trigger body. Whenever user triggers the condition ( BEFORE or AFTER ), the action is performed and this action is performed using the signal keyword.....rightly to signal the action when the specific condition triggers.


All times are GMT +5.5. The time now is 01:04 AM.