spin_eight spin_eight - 10 months ago 63
SQL Question

using define statement in PL/SQL developer

This is one of the tasks from my homework assignement:

DEFINE countryid = CA
country_record countries%ROWTYPE;
INTO country_record
FROM countries
WHERE country_id = '&countryid';

According to the task requirements countryid should be declared using define statement and should be given default value CA, then select should be performed based on value entered by the user.

When I run script i get 4 errors, when I comment out DEFINE countryid = CA
scripts executes successfuly.

My question: is define statement availiable in PL/SQL Developer?

If it is, what I am doing wrong and could you suggest a proper usage?

edit: I get the following errors:

ORA-06550 row 3 column 8
PLS-00201 identificator 'COUNTRY_RECORD' have to be declared
ORA-06550 row 4 column 3
PL/SQL ORA-00904: invalid identificator
ORA-06550 row 2 column 3
PL/SQL SQL statement ignored

Answer Source

DEFINE is a SQLPLUS thing, and as such isn't supported in PLSQL Developer apart from in the COMMAND window. for the sql / test window, just remove it (it will see the & and give you a popup for you to define it that way).