12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Retrieving Data With Queriesdocument the <strong>SQL</strong> statements. The comments (or remarks) in this example begin with--.Example 6–1Using SELECT to Retrieve Data-- the following uses the wildcard * to retrieve all the columns of data in-- all rows of the employees tableSELECT * FROM employees;Example 6–2 shows how to use SELECT to retrieve the data for specific columns of theemployees table. In this example, you explicitly enter the column names in theSELECT statement.Example 6–2Using SELECT to Retrieve Data From Specific Columns-- the following retrieves the data in columns employee_id, last_name, first_nameSELECT employee_id, last_name, first_name FROM employees;See Also:■<strong>Oracle</strong> Database <strong>SQL</strong> Reference for detailed information on the <strong>SQL</strong>SELECT statement.6.2.2 Using Character Literals in <strong>SQL</strong> StatementsMany <strong>SQL</strong> statements, functions, expressions, and conditions require you to specifycharacter literal values. You can specify character literals with the following notations:■Character literals with the 'text' notation, as in the literals 'users01.dbf'and 'Muthu''s computer'.■ National character literals with the N'text' or n'text' notation, where N or nspecifies the literal using the national character set. For example, N'résumé' is aNational character literal.For information on unicode literals, see Unicode String Literals.6.2.2.1 Quoting Character LiteralsBy default you must quote character literals in single-quotes, as in 'Hello'. Thistechnique can sometimes be inconvenient if the text itself contains single quotes. Insuch cases, you can also use the Q-quote mechanism, which enables you to specify qor Q followed by a single quote and then another character to be used as the quotedelimiter. For example, the literal q'#it's the "final" deadline#' uses thepound sign (#) as a quote delimiter for the string it's the "final" deadline.The Q-quote delimiter can be any single- or multibyte character except space, tab, andreturn. If the opening quote delimiter is a [, {, , or ) character. In all other cases, theopening and closing delimiter must be the identical character.The following character literals use the alternative quoting mechanism:q'(name LIKE '%DBMS_%%')'q''q'"name like '['"'nq'ïŸ1234ï'<strong>SQL</strong>: Usage Information 6-3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!