running long sql in VB

nn992

New Member
Joined
Jul 28, 2016
Messages
47
Hello everyone,

I am trying to run a long sql code within my VBA, and I am using correct concatenate signs, but still getting the error message.

I even tried to remove the concatenation and run it in SQL developer and it worked, but when I run it within VBA, I am getting error "ORA - 00923 FROM keyword not found where expected runtime error 2147467259 (80004005)"


Any ideas are welcome!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Can you please post the VBA code addressing the SQL so we can see it?
Maybe something will stand out.
 
Upvote 0
That is odd, because I do not even see "ORA - 00923 FROM" anywhere in the SQL code.

This part does look odd to me though:
Code:
[COLOR=#333333]FROM [/COLOR][EMAIL="flt_perf.dim_ntfm_ftfm@PORAPE5_ACCESS.WORLD"]flt_perf.dim_ntfm_ftfm@PORAPE5_ACCESS.WORLD[/EMAIL][COLOR=#333333] a[/COLOR]
I don't like the "@" in the table name, and the ".WORLD" structure usually indicates a field named "WORLD" in that table, but you uses data sources (tables/queries) in your FROM clauses, not fields (fields would be used in the JOIN part of the statement).

Can you explain this part of the code?
Maybe it is just some syntax I am not familiar with...

 
Upvote 0
It is just a connection to the table from another database...

Could it maybe be that he reads some part of the code as a comment? Because I had to keep commented parts at the end of the continuations, due to the reading issue.

Important to note is that when I remove continuations and run this same code as it is in SQL developer it works perfectly.
 
Upvote 0
That is odd, because I do not even see "ORA - 00923 FROM" anywhere in the SQL code.



I think he is trying to tell me that there is a bad connection between FROM and SELECT statements within the code
 
Upvote 0
Could it maybe be that he reads some part of the code as a comment? Because I had to keep commented parts at the end of the continuations, due to the reading issue.

Important to note is that when I remove continuations and run this same code as it is in SQL developer it works perfectly.
That would seem to be suggest that is probably the issue.
 
Upvote 0
is there some SQL function to tell him "stop reading as comment" or something similar?

Do you maybe have idea how it could be applied to the code?
 
Upvote 0
In using VBA code to build SQL code, I have actually never tried to mix comments in with the code. I am not sure you can do that.
Why would you want to anyway? SQL code written via VBA is really not all that readable anyway.

What are you going with the SQL code you are building?
Are you just running it, or are you assigning it to a query?
 
Last edited:
Upvote 0
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,426
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top