Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gotpewi
Starting Member
1 Post |
Posted - 2008-08-28 : 08:49:18
|
| Hi,need to get this question solved before continuing with converting SQL Server stored procedures to Oracle PL/SQL procedures and the question is as follows.In SQL Server you can have a test if a record exists before doing anything:IF EXISTS(SELECT 1 FROM dbo.tableSomething)BEGIN ...ENDELSEBEGIN ...ENDHow is this implemented in PL/SQL?All suggestions are welcome, best regards Peter |
|
|
tfountain
Constraint Violating Yak Guru
491 Posts |
Posted - 2008-08-28 : 17:27:30
|
Short version:DECLARE vMatchCount PLS_INTEGER;SELECT COUNT(1) INTO vMatchCount FROM <schema.table> WHERE <whatever criteria you have>;IF vMatchCount != 0 THEN <do something>END IF |
 |
|
|
|
|
|