Skip to main content

SELECT DELETE STORED PROCEDURE

This stored procedure will help to select and delete records from table with passing variables.

create or replace PROCEDURE SP_DELETE_DATA (ID IN INTEGER,NAME IN VARCAHR2)
AS

CUR_01_F_COUNT NUMBER ;


CURSOR CUR_01 IS
SELECT COUNT(*)
FROM TABLE_NAME CF
WHERE ID         = ID
AND NAME=NAME;

BEGIN 


OPEN CUR_01;
FETCH CUR_01 INTO CUR_01_F_COUNT;
CLOSE CUR_01;
dbms_output.put_line(' COUNT FOR  IS :'||CUR_01_F_COUNT);

IF CUR_01_F_COUNT > 0 THEN

DELETE FROM TABLE_NAME WHERE ID=ID
AND NAME=NAME;

dbms_output.put_line('REMOVED COUNT IS :'||sql%ROWCOUNT);

IF SQL%ROWCOUNT>0 THEN
COMMIT;
END IF;
END IF;

Comments

Popular posts from this blog

Behavior Driven Development

Behavior Driven Development (BDD) is a development process that originally associated with Test-Driven Development (TDD).  BDD is written in a readable format in an understandable language for anyone involved in software development.  BDD Features Providing better readability and visibility.  Verifying the software against customer requirements.  Assure the implementation of the system is correct. Derives examples of different expected behaviors of the system. Uses examples as acceptance tests. Focus on customer requirements throughout the development. BDD Practice There are two practices in BDD:-  Specification by Example (SbE). Test-Driven Development (TDD). Specification by example (SbE) uses examples in conversation to illustrate the business rules and the behavior of the software.  This uses to have a better understanding for Business Analyst, Product Owners, Testers and the Developers to reduce the misunderstanding abou...