It’s hard to know why you’re getting that without seeing the whole script, but my guess is you’re trying to use it outside the current block. Here’s some
Make sure your variables are used within the master begin/end
Define your variables in your declare section
Put your select statements in begin/end clauses - that way you can add exceptions to them as needed and control your data better.
*dbms_output.put_line *statements to see your output - this will show you the values of your variables along the way.
Include exception clauses in your blocks and at the end of your anonymous block to capture errors.
Also, know that unless your query your building returns only one row, then you’re going to run into an error of fetching too many rows, unless you handle
it - again, a good use of exceptions.
Here’s an example of the things I mentioned above…
Data Found between dates’);
From: Mark J [mailto:bounce-Mark_J@toadworld.com]
Sent: Wednesday, January 28, 2015 1:42 PM
Subject: [Toad for Oracle - Discussion Forum] Define vs declare date varaible in Toad for Oracle 220.127.116.11 using sql
Define vs declare date varaible in Toad for Oracle 18.104.22.168 using sql
Thread created by Mark J
I am relatively new to Oracle - having used Sql server for a few years
I am trying to create a date varaible in a script that will use it in multiple statements later in the script.
This declare statement seems to work when I execute it as a script:
into start_dt from dual;
but when I try to join to it later in the follwong where clause:
I get a message “ORA-00904: “START_DT”: invalid identifier”
Nay help would be appreciated.
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
this post as spam/abuse.