After Work
The best club in Chicago
for Chicago Singles is
Highlife Adventures!
Are you looking for a
Jersey Girl T-Shirt
?
Kyoto Sushi
in Chicago, on Lincoln Ave.
Moody's Pub
in Chicago, has great burgers
Skylark
in Chicago, on Halsted .. excellent Friday fish fry!
|
Oracle
»
PL-SQL
»
Coding
»
Creating a stored procedure
Below is a simple stored procedure which deletes an invoice.
Note:
- variable declaration placement
- the syntax for comments /* --- */
- ALL select statements must have an into statement for the
result set. Oracle stored procedures must use "out" variables to return
results to client programs.
- the declaration of INV_ID1 uses the column def as a prototype
CREATE OR REPLACE PROCEDURE PROC_DELETE_INVOICE
( USERID1 VARCHAR2, INV_ID1 INVOICE.INV_ID%TYPE )
AS
INV_COUNT NUMBER ;
BEGIN
INV_COUNT := 0;
/* check if invoice exists */
SELECT COUNT(*)
INTO INV_COUNT
FROM INVOICE
WHERE INV_ID = INV_ID1 ;
IF INV_COUNT > 0 THEN
DELETE FROM INVOICE WHERE INV_ID = INV_ID1 ;
COMMIT ;
END IF ;
END ;
|
|
|
|