Statement di controllo e di iterazione
This commit is contained in:
28
CASE-WHEN.sql
Normal file
28
CASE-WHEN.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
DECLARE
|
||||
V_CODFIDELITY VARCHAR2(20) := :CODFID;
|
||||
V_RESIDENZA VARCHAR2(30);
|
||||
BEGIN
|
||||
|
||||
SELECT
|
||||
TRIM(PROV)
|
||||
INTO
|
||||
V_RESIDENZA
|
||||
FROM
|
||||
CORSOPLSQL.CLIENTI
|
||||
WHERE
|
||||
CODFIDELITY = V_CODFIDELITY;
|
||||
|
||||
DBMS_OUTPUT.PUT_LINE('Provincia: ' || V_RESIDENZA);
|
||||
|
||||
-- Espressioni case
|
||||
CASE V_RESIDENZA
|
||||
WHEN 'OR' THEN
|
||||
DBMS_OUTPUT.PUT_LINE('Centro Sardegna');
|
||||
WHEN 'SS' THEN
|
||||
DBMS_OUTPUT.PUT_LINE('Nord Sardegna');
|
||||
WHEN 'CA' THEN
|
||||
DBMS_OUTPUT.PUT_LINE('Sud Sardegna');
|
||||
ELSE
|
||||
DBMS_OUTPUT.PUT_LINE('Non in Sardegna');
|
||||
END CASE;
|
||||
END;
|
||||
Reference in New Issue
Block a user