using define statement in PL/SQL developer

21,669

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

Share:
21,669
spin_eight
Author by

spin_eight

My history: My passion for software development started in 2002, from coding in school (physics & math lyceum) small game projects, 3d graphics in Turbo Pascal 7.0), continued in trainings for Olympiad programming in "ITMO University" (tutor Stankevich) and now continues to develop while doing industrial products for science companies. Background I graduated from the Saint-Petersburg Polytechnic University in 2014 (computer science). I developed software for navigation devices(air, marine, shore-based) for civil and military companies. About SO I registered at the Stackoverflow, because it is the good source of knowledge for me, where you can ask question end get a professional answer on it. Also it allows to test your comprehension of art of programming by answering questions and getting responses from participants. So I am very glad that I have found such a good community in which there are a lot of people who love computer science and enjoy their work.

Updated on November 18, 2020

Comments

  • spin_eight
    spin_eight over 3 years

    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