Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"IF" statement use Could you pleas

Status
Not open for further replies.

Iby

Programmer
Jul 17, 2002
18
0
0
IT
"IF" statement use
Could you please tell me somebody how can I use the "IF" clause?
Thank you!
 
From the docs

Alex


In the example below, if shoe_count has a value of 10, both the first and second Boolean expressions yield TRUE. Nevertheless, order_quantity is assigned the proper value of 50 because processing of an IF statement stops after an expression yields TRUE and its associated sequence of statements is executed. The expression associated with ELSIF is never evaluated and control passes to the INSERT statement.

IF shoe_count < 20 THEN
order_quantity := 50;
ELSIF shoe_count < 30 THEN
order_quantity := 20;
ELSE
order_quantity := 10;
END IF;

INSERT INTO purchase_order VALUES (shoe_type, order_quantity);


In the following example, depending on the value of score, one of two status messages is inserted into the grades table:

IF score < 70 THEN
fail := fail + 1;
INSERT INTO grades VALUES (student_id, 'Failed');
ELSE
pass := pass + 1;
INSERT INTO grades VALUES (student_id, 'Passed');
END IF;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top