PL/SQL

Learn Pl/sql example and some think new :

 

Dowload Example Click Here.

 

PL/SQL PL/SQL has the following advantages: 


*   SQL is the standard database language and PL/SQL is strongly  integrated    with SQL. PL/SQL        supports both static and dynamic SQL. Static SQL supports DML operations and transaction    control from PL/SQL block. Dynamic SQL is SQL allows embedding DDL statements in PL/SQL    blocks. 

*   PL/SQL allows sending an entire block of statements to the database at one time. This    reduces network traffic and provides high performance for the applications. 
*   PL/SQL gives high productivity to programmers as it can query, transform, and update data in a database. 
*  PL/SQL saves time on design and debugging by strong features, such as exception handling, encapsulation, data hiding, and object-oriented data types. 
*   Applications written in PL/SQL are fully portable. 
*   PL/SQL provides high security level. 
*   PL/SQL provides access to predefined SQL packages. 
*   PL/SQL provides support for Object-Oriented Programming. 
*  PL/SQL provides support for Developing Web Applications and Server Pages.

new_line function Eaxmple :


/*
    new_line function
   
    - This function is use to put a containt in new line.
    - This function is not take any argument.
*/

SET SERVEROUTPUT ON;
SET FEEDBACK OFF;

BEGIN
    dbms_output.put('kartik ');dbms_output.put_line('Butani');
    dbms_output.new_line();
    dbms_output.put_line('krButani');

END;

/

A PL/SQL is provide two way populate the variables with a value. 

These are:


•:= - The colon/equal sign assigns the argument on the left of the
        operator to the argument or variable on the right of the sign.

•Into - The Into keyword is used in a Select or Fetch statement. When
            used in a Select statement, it assigns the values in the Select
            clause to the variables following the Into keyword. When used
            with the Fetch statement, it assigns the cursor values to the
            variables that follow the Into keyword.

This program is display table with the use of for in loop  


/*
    This program is display table with the use of for in loop
   
    and for better output display we use rpad function
   
    rpad Function
        it is use to display the well format.
       
        Systax : rpad( string / number , column size , repeated string / number )
       
        1. string / number is use to display actual message on screen.
   
        2. column size means the how many charate display on screen 
                 if the character size is big then it is discarded.

        3. repeated string or number can repeate the string charate or number 
                 if string / number is small of column size.
*/

SET SERVEROUTPUT ON;

BEGIN
    DBMS_OUTPUT.PUT_LINE( rpad( 'Acct_id', 8) || ' ' || rpad( 'Balance',10 ) );   

    DBMS_OUTPUT.PUT_LINE( rpad( '-', 8, '-' ) || ' ' || rpad( '-', 10, '-' ) );

    FOR X IN (select *from account)
    LOOP
        DBMS_OUTPUT.PUT_LINE( rpad( X.acct_id, 8) || to_char(X.bal,'9999.99'));
    END LOOP;
END;
/

PL/SQL User Defined Subtypes 


/*
    PL/SQL User Defined Subtypes 
   
    - A subtype is a subset of another data type, which is called its base type. A subtype has the same valid operations as its base type, but only a subset of its valid values.
   
    Example of Subtype
*/
SET SERVEROUTPUT ON;
SET FEEDBACK OFF;

DECLARE 
    SUBTYPE no IS NUMBER(10); 
    SUBTYPE name IS VARCHAR2(20); 
    /*
        string initilzation is two way possible in declare section.
        emp_name name := 'Sita';
        emp_name name DEFAULT 'Sita';
    */
    emp_no no;
    emp_name name; 
BEGIN 
    emp_no := 100;
    emp_name := 'Ram';
    dbms_output.put_line('Hello ' || emp_name || ' Your Number is : ' || emp_no); 
END; 
/

Download Example of Pl/Sql :

New Line Function : Download

userdefine datatype create : Download

print hole db table : Download

Implecity Cursor : Download 

Student Master table Example : Download

plsql_area : Download

plsql_for : Download

plsql_loop : Download

plsql_goto : Download

plsql_while : Download

plsql_ifelse : Download

Assignment

Assignment Q2-Q6 : Download

some tirangle :

 Triangel 1 : Download 

 Triangle 2 : Download

 Triangle 3 : Download

 Triangle 4 : Download

class room create program Example :

plsql if statement : Download

Implicity Cursor : Download





Comments

Post a Comment

Popular posts from this blog

How to create a custom form in wordpress

My new Jquery Plugin name is krDailog