SQL Commands - 17,601 have oucan help Wikimedia change the...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
17,601 have You     can help Wikimedia change the world!     » Donat "Thank you for constantly feeding my quest for knowledge" — Drew G. Programming:Oracle PL/SQL Cheatsheet From Wikibooks, the open-content textbooks collection Jump to: navigation , search This "cheatsheet" covers most of the basic functionality that an Oracle DBA needs to run basic queries and perform basic tasks. It also contains information that a PL/SQL programmer will frequently use to write stored procedures. The resource is useful as a primer for individuals who are new to Oracle, or as a reference for those who are experienced at using Oracle. A great deal of information about Oracle exists, scattered throughout the net. This resource was developed in order to make it easier for programmers and DBAs to find most of the basics in one place. When a topic is beyond the scope of a "cheatsheet" a link is generally provided for further research. Other Oracle References Oracle XML Reference - the XML reference is still in its infancy, but it will be coming along nicely before long. Contents [ hide ] 1 Queries o 1.1 SELECT o 1.2 SELECT INTO o 1.3 INSERT o 1.4 UPDATE 1.4.1 Setting constraints on a table 1.4.2 Unique index on a table o 1.5 SEQUENCES 1.5.1 CREATE SEQUENCE
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1.5.2 ALTER SEQUENCE o 1.6 GENERATE QUERY FROM A STRING o 1.7 String Operations 1.7.1 Trim 1.7.2 Replace 1.7.3 Instr 2 DDL SQL o 2.1 Tables 2.1.1 Create Table 2.1.2 Add Column 2.1.3 Modify Column 2.1.4 Drop Column 2.1.5 Rename Table 2.1.6 Constraints 2.1.6.1 Constraint Types and Codes 2.1.6.2 Displaying Constraints 2.1.6.3 Creating Unique Constraints 2.1.6.4 Deleting Constraints o 2.2 INDEXES 2.2.1 Create an Index 2.2.2 Create a Function-Based Index 2.2.3 Rename an Index 2.2.4 Collect Statistics on an Index 2.2.5 Drop an Index 3 PL/SQL o 3.1 Operators 3.1.1 Arithmetic Operators 3.1.1.1 Examples 3.1.2 Comparison Operators 3.1.2.1 Examples 3.1.3 String Operators 3.1.4 Date Operators o 3.2 Types 3.2.1 Basic PL/SQL types 3.2.2 %TYPE - anchored type variable declaration 3.2.3 Collections o 3.3 Stored Logic 3.3.1 Functions 3.3.2 Procedures 3.3.3 Passing Parameters to Stored Logic 3.3.3.1 Positional notation 3.3.3.2 Named notation 3.3.3.3 Mixed notation 3.3.4 Table Functions o 3.4 Flow Control
Background image of page 2
3.4.1 If/Then/Else [ edit ] Queries [ edit ] SELECT SELECT * FROM Namibia WHERE col1 = 'value1' AND col2 = 'value2' [ edit ] SELECT INTO Select into takes the values name , address and phone number out of the table employee and places them into the variables v_employee , v_employee_address and v_employee_phone_number . This only works if the query matches a single item. If the query returns no rows it will raise the NO_DATA_FOUND built-in exception. If your query returns more than one row, Oracle will raise the exception TOO_MANY_ROWS.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

SQL Commands - 17,601 have oucan help Wikimedia change the...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online