Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using define statement in PL/SQL developer

This is one of the tasks from my homework assignement:

DEFINE countryid = CA
DECLARE 
country_record countries%ROWTYPE;
BEGIN
  SELECT *
  INTO country_record
  FROM countries
  WHERE country_id = '&countryid';
END;

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
like image 575
spin_eight Avatar asked Nov 21 '25 13:11

spin_eight


1 Answers

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).

like image 79
DazzaL Avatar answered Nov 23 '25 04:11

DazzaL