Replies: 9 comments
-
@sfintz Hello. Did you exucute statements 1, 2 and 3 one by one or as a whole script? If 1 and 2 worked, then can you please show me the query that leads to “SQL Error [903] [42000]: ORA-00903: invalid table name”, it can be found in query manager |
Beta Was this translation helpful? Give feedback.
-
Hi @Matvey16 - I ran 1, 2, 3 one by one. In both scenarios, the errors are from the queries in # 3 (I only trimmed the actual table name for data privacy reasons). Please let me know if that helps get to the bottom of this. Thank you! @sfintz |
Beta Was this translation helpful? Give feedback.
-
@sfintz So the table was created succesfully? I need to see what query was sent to database and led to the error. You can find it in query manager It will look like this Also can you please type |
Beta Was this translation helpful? Give feedback.
-
Hi @Matvey16 - I mis-wrote earlier as the "SQL Error [900] [42000]: ORA-00900: invalid SQL statement" in scenario #1 came from the SQL statement #1 (define TN_CP = ‘CP_202201’; which when not trimmed is define TN_CP = ‘cube_param_202201’; ). I could not proceed to #2 and #3 because of that. See below for the query manager snippet for that SQL statement #1 and let me know if that helps clarify better. @sfintz |
Beta Was this translation helpful? Give feedback.
-
@sfintz If I understood you correctly you are trying to create a variable with If I understood you correctly, your script will be something like this
|
Beta Was this translation helpful? Give feedback.
-
Hi @Matvey16 - I had to tweak what you provided above slightly to the below and it worked. Thank you so much! @set TN_CP = CP_202201 Out of curiosity why is the define function not an option here? I thought that was an Oracle SQL database syntax element but apparently that is not the case. |
Beta Was this translation helpful? Give feedback.
-
@sfintz if you refer to this https://blogs.oracle.com/opal/post/sql*plus-substitution-variables-define-variables-and-parameters-in-sql-queries define is sql plus syntax, so is specific to that oracle tool. That said, there might be other tools supporting that syntax for compatibility with sql plus, but it's not part of the oracle sql dialect. |
Beta Was this translation helpful? Give feedback.
-
got it. thanks @p91paul . |
Beta Was this translation helpful? Give feedback.
-
@Matvey16 thanks for sharing example: I'm trying to create table where table name have current date in it, like "schema.my_table_03_03_2023". Have tried to set date to variable (current_date) and pass to query, however ${TN_CP} is returning NULL. |
Beta Was this translation helpful? Give feedback.
-
System information:
Connection specification:
Describe the problem you're observing:
SQL Developer variable table name works but DB Weaver does not
Steps to reproduce, if exist:
In SQL Developer the below works with an Oracle Database:
I want to do the same in DB Weaver but can not figure it out as #1 gets me the below error: SQL Error [900] [42000]: ORA-00900: invalid SQL statement
I then tried the below with @set and hit a snag at #3:
— THIS DOES NOT WORK as I get “SQL Error [903] [42000]: ORA-00903: invalid table name” BUT
— select * from CP_202201; does work which tells me there is some issue with the table variable being set
Please help.
Include any warning/errors/backtraces from the logs
Beta Was this translation helpful? Give feedback.
All reactions