Plsql Grammar in layman's language

Source: Internet
Author: User

One: Plsql Overview: Plsql is a process language that Oracle expands on the basis of SQL. Plsql provides typical high-level language features, including encapsulation, exception handling mechanisms, information hiding, object-oriented, etc., and brings new programming ideas to the database server and toolset. Compared with java,  C #, the Plsql advantage is that the SQL language can be written directly into Plsql's "blocks" or plsql processes and functions. There is no need to create a statement object to execute sql;  like Java, which makes Plsql a very powerful transactional language, which is to use SQL to process data and handle business logic using a control structure. Two: Plsql block concept: Plsql is a kind of Pascal language, each program is composed of block declare (Optional)     Variables, cursors, user-defined Exceptionsbegin (Mandatory)    ? SQL statements    PL statementsexception (Optional)     Actions to perform when errors occurend; (M Andatory)   Three: Plsql variable type: 1, the system built-in general simple variable type 2, user-defined complex variable type: For example, record type 3, reference type: Save a pointer 4, large object type (LOB): Save a point to the large object of the address   Four: Common function Introduction: Dbms_output. Put_Line (); output, output the value of the intermediate variable when debugging select    into  statement: Used to store the contents of the query from the database into variables insert, UPDATE, DELETE, Merge statement: Executing these SQL statements in Plsql is similar to executing these statements directly, except that you can use PLSQL declared variables in SQL statements;  Five: Plsql control statements: ①: Conditional Statements If Conditionthen statements; [elsif conditionthen statements;] [ELSE statements;] END if;  case selectorwhen expression1then result1when ExprEssion2then result2 ... When Expressionnthen Resultn[else resultn+1;] END Case;  ②: Loop statement loop                     statement1;. . . EXIT [when condition]; END loop;   whileconditionloopstatement1;statement2; . . . END loop;   for counter in [Reverse]lower_bound.. upper_boundloop statement1; Statement2; . . . END LOOP;

Plsql syntax in layman's language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.