Oracle SQL Developer
Oracle SQL Developer
Oracle SQL Developer
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Utilizing the Main Features of PL/<strong>SQL</strong>Characters such as hyphens, slashes, and spaces are not allowed. For example thefollowing identifiers are not allowed:mine&yours is not allowed because of the ampersanddebit-amount is not allowed because of the hyphenon/off is not allowed because of the slashuser id is not allowed because of the spaceYou can use upper, lower, or mixed case to write identifiers. PL/<strong>SQL</strong> is not casesensitive except within string and character literals. Every character, including dollarsigns, underscores, and number signs, is significant. If the only difference betweenidentifiers is the case of corresponding letters, PL/<strong>SQL</strong> considers them the same, as inthe following:lastname is same as LASTNAME and LastNameLastName is the same as lastname and LASTNAMELASTNAME is same as lastname and LastNameThe size of an identifier cannot exceed 30 characters. Identifiers should be descriptive.When possible, avoid obscure names such as cpm. Instead, use meaningful names suchas cost_per_thousand.Some identifiers, called reserved words or keywords, have a special syntactic meaningto PL/<strong>SQL</strong>. For example, the words BEGIN and END are reserved. Often, reservedwords and keywords are written in upper case for readability. Neither reserved wordsor keywords should be used as identifiers and the use can cause compilation errors.See Also: PL/<strong>SQL</strong> User's Guide and Reference for information onPL/<strong>SQL</strong> reserved words and keywords7.3.5 Assigning Values to a Variable With the Assignment OperatorYou can assign values to a variable in several ways. One way uses the assignmentoperator (:=), a colon followed by an equal sign, as shown in Example 7–5. You placethe variable to the left of the operator and an expression, including function calls, tothe right. Note that you can assign a value to a variable when it is declared.Example 7–5Assigning Values to Variables With the Assignment OperatorDECLARE -- declare and assiging variableswagesNUMBER(6,2);hours_worked NUMBER := 40;hourly_salary NUMBER := 22.50;bonus NUMBER := 150;country VARCHAR2(128);counter NUMBER := 0;doneBOOLEAN := FALSE;valid_id BOOLEAN;BEGINwages := (hours_worked * hourly_salary) + bonus; -- compute wagescountry := 'France'; -- assign a string literalcountry := UPPER('Canada'); -- assign an uppercase string literaldone := (counter > 100); -- assign a BOOLEAN, in this case FALSEvalid_id := TRUE; -- assign a BOOLEANEND;/7-6 <strong>SQL</strong> <strong>Developer</strong> Online Help