jeudi 27 février 2020

IF statement doesn't allow Select statement to compare the given string

I have a query here: Please download and see the screenshot where i have mentioned many things: 1) In picture 2, i tried to compare if the given course name is present in the table or not using cursor (BECAUSE I TRIED TO COMPARE IT USING IF STATEMENT BUT IT WAS GIVING ME ERROR THAT I CAN'T USE SELECT QUERY IN IF STATEMENT, I DON"T KNOW WHY). Procedure is compiled but after execution, no row is getting affected.

2) In picture 3, I tried the count to be compared in IF statement which is easy but im not sure to use it. I want to use the SELECT statement to compare.

3) In picture 4, FETCHNAME_CUR.CNAME is okay but when running it is giving me error of UNIQUE CONSTRAINT VIOLATION which i don't understand why.

Finally, How can i check if the given name is present in any column of a table using select statement and then use IF statement to do some work without using any COUNT or counter (which is easily comparable in IF statement). Please help me. Many thanks.download the image by clicking here

Aucun commentaire:

Enregistrer un commentaire