Posted Answers
June 30th, 2008elifeinchrist
SQL is a structured query language thats used to perform operations such as retrieval, updations,i nsertions etc. on database. It is used in MS SQL Server and Oracle and other databases.
PL/SQL is a Programming language which is an extension for SQL with control structures added to them. Number of SQL statements can be written together in PL/SQL. PL/SQL is used by Oracle. T-SQL which is similar to PL/SQL is used by MS SQL Server.
Answer by elifeinchrist
June 30th, 2008Anonymous
What are SQL Commands?
SQL commands are commands that aren't actually a part of the SQL standard but are supported by the tools that support SQL. For example, SQL*Plus has been around a long time and many tools that allow scripting also allow SQL*Plus commands. When someone asks me about a SQL command, I first clarify if the mean a SQL keyword or a SQL*Plus (or some other tool) command. SQL commands are usually meant to help format output: BREAK, BTITLE, COLUMN, PRINT or they are meant to create or store data or scripts: COMPUTE, DEFINE, STORE, SAVE. There are also commands that interact with the database: SHUTDOWN, CONNECT, COPY. And there is at least one that interacts with data: XQUERY. So when you hear someone refer to a SQL command, first ask if they really mean SQL or if they mean the SQL tool they are using.
What is PL/SQL?
The quick answer is from the PL/SQL User Guide: PL/SQL, Oracle's procedural extension of SQL, is an advanced fourth-generation programming language (4GL). It offers software-engineering features such as data encapsulation, overloading, collection types, exceptions, and information hiding. PL/SQL also supports rapid prototyping and development through tight integration with SQL and the Oracle database. But what does that mean? The key here are the words: procedural extension of SQL. PL/SQL is a procedural language like C++, Java, ADA, etc. If has variables and variable declarations, conditional controls like IF and CASE. It has looping structures such as LOOP, FOR LOOP and the WHILE LOOP. PL/SQL uses SQL to use, manipulate and save data to the database. If I wanted to create my own, very short, definition of PL/SQL it would be this: PL/SQL is the Oracle native programming language that provides database-centric application development. It can natively call static SQL and provides multiple methods of calling dynamic SQL.
Example PL/SQL:
BEGIN -- A PL/SQL
cursor FOR c1 IN ( SELECT * FROM whatever ) -- This is SQL called by PL/SQL
LOOP
DBMS_OUTPUT.PUT_LINE( 'Column1 is: ' || TO_CHAR(c1.column1) || ', Column2 is: ' || c1.column2 || ', Column3 is: ' || TO_CHAR(c1.column3 ) );
END LOOP;
END;
Answer by Anonymous