Re: Run Oracle scripts on Squirrel SQL
Matheus Garcia <matheus.figueiredo <at> almg.gov.br>
2011-12-22 14:26:09 GMT
Thanks for replying, Drav.
First of all, forgot to say, but I was using 3.1, now I upgraded to 3.3.0. Running on Linux.
I tried
SELECT :var FROM dual
and squirrel asked me for the value of var, very good, thanks!
Then I tried the code:
DECLARE
v1 NUMBER(3);
BEGIN
v1 := 3;
select v1 from dual
END;
/
After adding the slash in the end, instead of "java.lang.IllegalArgumentException: No SQL selected for execution.", I'm getting the following error:
Error: ORA-06550: line 7, column 1:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
SQLState: 65000
ErrorCode: 6550
Searching on internet for error PLS-00103 lead me to the following question in stack overflow:
http://stackoverflow.com/questions/2289723/statement-execute-returns-error-with-slash-at-the-end-of-pl-sql
Where I can extract from the answers and comments:
"As the message indicates, the compiler doesn't want to encounter the symbol "/", so just remove it. That simple. Let me explain. When using sqlplus or an SQL worksheet in sqldev, you do well appending your PL/SQL blocks with the slash. However, when using the procedure editor (native to sqldev), you'll have to remove it. (...)"
"In SQL Developer you would need to click the "Run Script (F5)" button to create all of your triggers (not the main "Run Statement" button)"
So, if I understood it correctly, I think squirrel should have another option to run (oracle) scrips, is it? Or am I missing something?
Matheus
Em Qui, 2011-12-22 às 13:26 +0000, Drav Sloan escreveu:
Matheus Garcia wrote:
> Although I saw it's possible to do something like that in Oracle PL-SQL,
> I couldn't run any samples I got on internet in SQuirrel SQL. My oracle
> connection is correctly configured, I can run simple sql commands, but
> when I try to somethibng like the the following code:
>
> DECLARE
> v1 NUMBER(3);
>
> BEGIN
> v1 := 3;
> select 1 from dual
> END;
>
> the DECLARE keywork appears in red, and when I try to run I got the
> following error: "java.lang.IllegalArgumentException: No SQL selected
> for execution."
Make sure you leave no gaps in your SQL and make sure you follow
your procedural code with a /
DECLARE
v1 NUMBER(3);
BEGIN
v1 := 3;
select v1 from dual
END;
/
The above should now run :)
Also you can do parameters like MSQL:
First off make sure you have SQL Parametrisation turned on (found
under Plugins -> Summary (and called sqlparam).
Then you can do
SELECT :var FROM dual
and Squirrel should ask you for the value of :var.
Regards
D.
-- Matheus Garcia Barbosa de Figueiredo Tel.: (31) 2108 - 7018 Analista de Sistemas Gerência de Desenvolvimento de Sistemas - GDS Gerência-Geral de Sistemas de Informação - GSI Assembleia Legislativa de Minas Gerais - ALMG
|
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Squirrel-sql-users mailing list
Squirrel-sql-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users