http___www.knjiga.ba_racunari_programiranje_oracle-10g-pl-sql-programiranje-k0624.html_1.xml
1.1 2.1 3.1 4.1 5.1 6.1 12.1 14.1 14.2 15.1 16.1 18.1 19.1 20.1 20.2 20.3 21.1 22.1 22.2 23.1 23.2 24.1 25.1 25.2 25.3 25.4 26.1 27.1 27.2 28.1 28.2 28.3 29.1 29.2 30.1 30.2 31.1 32.1 33.1
The case/switch Statement While not an essential part of any language, the case statement is more elegant than: IF (x   ELSIF (X   ELSIF (x   ELSE   END IF; Unfortunately, PL/SQL allows only the clumsy IF-THEN-ELSE method of testing multiple conditions. Incrementing Variables The ability to increment or decrement a variable in C using the , and operators is something that I ve often wished for while coding a procedure or function. Instead, you ll have to nSum := nSum + 1; While functionally equivalent, the previous example simply seems less You can create a stored function that accepts an integer value and returns the value incremented by one, although it hardly seems worth the effort. How Does The Database Parse SQL And PL/SQL? Sit down in front of a computer and get to an SQL prompt. Get comfortable. Then execute the following commands at the SQL prompt: set serveroutput on SELECT 23 FROM DUAL; Notice that as soon as you finished typing your command, SQL*Plus sent the command off to the database for a response. Now enter this block of PL/SQL code: DECLARE iRowCount integer; BEGIN SELECT 23 INTO iRowCount FROM DUAL; SELECT 18 INTO iRowCount FROM DUAL; DBMS_Output. Put_Line ('The value of iRowCount is ' to_char (iRowCount)); END; / You might notice that none of your SQL commands were executed until you finished your PL/SQL block and told SQL to execute the block with the / character. You may sit in front of SQL every day and not have noticed this difference before, but you should notice it now. The Oracle7 database handles SQL and PL/SQL commands differently. Each SQL statement inside your PL/SQL block was sent to the database only when the PL/SQL block went to the database. Figure 2.12 illustrates this concept. Figure 2.12 How Oracle7 parse SQL and PL/SQL statements. An SQL statement is immediately matched against existing statements in the SGA. If no matching SQL statement is found, the statement is reparsed and then executed; A PL/SQL block is sent to the database as a whole concept. Because a PL/SQL block can contain both SQL statements and other PL/SQL blocks, the database will then handle each SQL statement and each PL/SQL block inside the main PL/SQL block. When the procedure has finished executing or an error condition occurs, a response is given to the user who executed the procedure. This difference may seem to be insignificant, but the nature of PL/SQL makes it much better suited for client/server development than SQL. Each SQL statement Consider 10 SQL statements sent over a network individually versus 1 PL/SQL block that contains 10 embedded SQL statements; 1 call to the network is necessary to send the PL/SQL block, while 10 calls are required for the individual SQL statements. Furthermore, the result sets for the embedded SQL statements are not sent back across the network, further reducing the number of packets required to complete the PL/SQL call. Summary Hopefully, this chapter has given you a basic In the coming chapters, you ll cover not only some detailed examples of SQL and PL/SQL code, but you ll also be given insight into the design and testing of these procedures.
1.1 2.1 2.2 2.3 2.4 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 14.2 14.3 15.1 16.1 17.1 18.1 19.1 20.1 21.1 22.1 23.1 24.1 25.1 26.1 27.1 28.1 29.1 30.1 31.1 32.1 33.1 34.1 35.1 36.1 37.1 38.1
Detalji Napravite dinamičke klijent/server aplikacije koristeći PL/SQL i obimne informacije koje ćete pronaći u ovoj knjizi. Stručnjaci za Oracle opisuju osobine PL/SQL-a, objašnjavaju semantiku i sintaksu pitanja skripta i detaljno objašnjavaju funkcionalnost PL/SQL-a baze podataka Oracle 10g. Naučićete kako da napravite moćne PL/SQL programe, komunicirate sa bazama podataka Oracle, obavljate složena izračunavanja i obrađujete greške. Osim toga, dobićete savjete za programiranje i tehnike koje možete upotrijebiti, i praktične primjere iz svijeta Oraclea. - Napravite, podesite i debagujte PL/SQL programe u različitim okruženjima pomoću kojih se radi sa bazama podataka Oracle. Koristite PL/SQL blokovske strukture, promenljive, tipove podataka, izraze, operatore i iskaze. - Kontrolišite i oporavite bazu podataka od grešaka koristeći izuzetke i rutine za obradu grešaka. - Prosledite podprograme, procedure, funkcije, pakete i okidače. Ostvarite komunikaciju između sesija pomoću paketa DBMS_PIPE i DBMS_ALERT. - Napravite objektno-orijentisane PL/SQL aplikacije. - Obrađujte velike skupove podataka koristeći slogove i objekte PL/SQL-a. - Koristite Oracle Net Services, spoljašnje procedure, Java biblioteke i deljene bibilioteke koje su napravljene u programskom jeziku C. - Ostvarite objektno-orijetisano programiranje pomoću privremenih objekata, nasleđivanja, evoluiranja tipova podataka i promene atributa. - Automatizujte poslove baze podataka pomoću paketa DBMS_JOB i DBMS_SCHEDULER, a funkcionalnost prosledite elektronskom poštom pomoću paketa UTL_SMTP i UTL_MAIL. O autorima Skot Urman autor čije se knjige nabolje prodaju, član je tima za dijagnostiku i otklanjanje problema u Oracle korporaciji. Ron Hardmen, OCP viši analitičar podataka, Oracle Support Services. Majkl MekLaflin, D.CS. viši menadžer nadogradnje aplikacija, Oracle Application Development. Kratak sadržaj Deo I: Uvod 1 Uvod u programski jezik PL/SQL 2 Korišćenje alata SQL*Plus i JDeveloper 3 Osnove programskog jezika PL/SQL 4 Upotreba programskih jezika SQL i PL/SQL 5 Slogovi 6 Kolekcije 7 Obrada grešaka 8 Pravljenje procedura, funkcija i paketa 9 Upotreba procedura, funkcija i paketa Okidači baze podataka Deo II: Napredne osobine programskog jezika PL/SQL Komunikacija između sesija Spoljašnje rutine Dinamički SQL Uvod u objekte Objekti baze podataka Veliki objekti Planiranje poslova Deo III: Dodaci A Rezervisane reči programskog jezika PL/SQL B Vodič kroz ugrađene pakete Indeks