11.07.2015 Views

Capitolul IV Limbajul PL/SQL

Capitolul IV Limbajul PL/SQL

Capitolul IV Limbajul PL/SQL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

68InstrucŃiuniSecvenŃele de cod scrise în <strong>PL</strong>/<strong>SQL</strong> pot conŃine comenzi <strong>SQL</strong> (CREATE,INSERT, DELETE, DROP sau ALTER).Exemplu:Insert into deponent values (124, 'Ionescu Valer', 'Str. Crinilor Nr. 7, Craiova','0743123989');Pe lângă comenzile <strong>SQL</strong> sau atribuirile de valori limbajul <strong>PL</strong>/<strong>SQL</strong> dispunede un set complet de instrucŃiuni necesare controlului execuŃiei programului, caoricare limbaj procedural.InstrucŃiunea de decidere - IFÎn limbajul <strong>PL</strong>/<strong>SQL</strong> instrucŃiunea IF poate prezenta trei forme.a. IF-THENExemplu:BEGINEND;/-- Declaratii de variabilevanzari NUMBER(8,2) := 10100;cota NUMBER(8,2) := 10000;bonus NUMBER(6,2);ang_id NUMBER(6) := 120;IF vanzari > (cota + 200) THENEND IF;bonus := (vanzari - cota)/4;UPDATE angajati SET salar = salar + bonus WHEREangajat_id = ang_id;Astfel scris IF serveşte la condiŃionarea unei acŃiuni. AcŃiunea estedeclanşată dacă expresia logică are valoarea adevărat. SecvenŃa de cod caredescrie acŃiunea este plasată între THEN şi END IF.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!