Академический Документы
Профессиональный Документы
Культура Документы
com
Try It / Solve It 1.
Fill in the blanks.
, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
3. Examine the following anonymous block and choose the appropriate statement.
4. In Application Express:
BEGIN
SELECT LENGTH(p_string) INTO v_num_characters
FROM dual;
RETURN v_num_characters;
END;
, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
DECLARE
v_length_of_string INTEGER; BEGIN
OUTPUT : 18
5. Write an anonymous block that uses a country name as input and prints the highest and lowest
elevations for that country. Use the COUNTRIES table. Execute your block three times using United
States of America, French Republic, and Japan.
DECLARE
v_country_name varchar2(50):= 'United States of America';
v_lowest_elevation number(6);
v_highest_elevation number(6);
BEGIN
SELECT lowest_elevation, highest_elevation
INTO v_lowest_elevation, v_highest_elevation
FROM COUNTRIESWHERE country_name = v_country_name;
DBMS_OUTPUT.PUT_LINE('The lowest elevation for '||v_country_name||' is: '||v_lowest_elevation);
DBMS_OUTPUT.PUT_LINE('The highest elevation for '||v_country_name||' is: '||v_highest_elevation);
END
, Oracle and/r its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
LITERALS An explicit numeric, character string, date, or Boolean value that is not
represented by an identifier.
RESERVED WORDS Words that have special meaning to an Oracle database and cannot
be used as identifiers.
COMMENTS Describe the purpose and use of each code segment and are ignored
by PL/SQL.
LEXICAL UNITS Building blocks of any PL/SQL block and are sequences of characters
including letters, digits, tabs, returns, and symbols.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliate respective owners.
Try It / Solve It Questions
1. Identify each of the following identifiers as valid or invalid. If invalid, specify why.
Today X
today’s_date X Contain ‘
Isleap$year X
#number X # on begining
NUMBER# X
Number1to7 X
create Y
make N
table Y
seat N
alter Y
rename Y
row Y
number Y
web N
3. What kind of lexical unit (for example Reserved word, Delimiter, Literal, Comment) is each of the
following?
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliate respective owners.
Value Lexical Unit
:= Delimiters
v_test Literal
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliate respective owners.
academy.oracle.com
NCLOB
Store large blocks of single-byte or fixed width multi-byte NCHAR data
in the database.
LOB
Hold values, called locators, that specify the location of large objects
(such as graphic images) that are stored out of line.
COMPOSITE
Contain internal elements that are either scalar (record) or composite
(record and table)
Try It / Solve It
1. In your own words, describe what a data type is and explain why it is important.
Because data has a values which is we used for pl/sql
3. Identify three data types covered in the Database Programming with SQL course. DATE,
NUMBER, BOOLEAN
4. What data type can be used in PL/SQL, but can’t be used to define a table column? Boolean
5. Which data type indicates a large data object that is stored outside of the database? LOB
6. Identify the data type category (LOB, Scalar, or Composite) for each data type. Each
category may be used more than once.
CLOB LOB
VARCHAR2 Scalar
BLOB LOB
NUMBER Scalar
BFILE LOB
TIMESTAMP Scalar
NCLOB LOB
RECORD Composite
PLS_INTEGER Scalar
LONG Scalar
TABLE Composite
BOOLEAN Scalar
, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
1 'Newman'
2 'Raman'
3 'Han'