CREAT PROCEDURE PROC1 ( NUM1 INT ) AS BEGIN IF( NUM1>100) BEGIN PRINT‘PASS’ END ELSE BEGIN PRINT‘FAIL’ END END
How to use this concept in programming?
As it is widely used in most of the application. So one should aware about this concept practically.
Suppose we have insert command from the user side then first we need to verify is that upcoming data is already exist or not.
Here is the small program for the above example:
CREATEPROCEDURE Proc_Info ( @PRSN_INTN_ID INT, @EMPL CHAR (20), @NAME CHAR (20), @REFERENCE INT ) AS BEGIN IFNOTEXISTS(SELECT PRSN_INTN_ID FROM EE_EMPL_CAT1 WHERE
PRSN_INTN_ID = @PRSN_INTN_ID) BEGIN INSERTINTO EE_EMPL_CAT1(PRSN_INTN_ID,[EMPL_STAT_CD],[NAME],REFERENCE_id) VALUES (@PRSN_INTN_ID,@EMPL,@NAME,@REFERENCE) END ELSE BEGIN PRINT'DATA ALREADY EXISTS' END END
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Simple way to learn about the Procedure:
Procedure is a group of SQL statement.
Syntax for the procedure
How to use this concept in programming?
As it is widely used in most of the application. So one should aware about this concept practically.
Suppose we have insert command from the user side then first we need to verify is that upcoming data is already exist or not.
Here is the small program for the above example: