Recent

Author Topic: pl sql script  (Read 8138 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 618
pl sql script
« on: December 06, 2014, 09:18:27 pm »
Is it Possible to run a PL/SQL script in Lazarus. I use ZEOSLIB components to run sql query's.

cpalx

  • Hero Member
  • *****
  • Posts: 753
Re: pl sql script
« Reply #1 on: December 07, 2014, 04:25:39 am »
Pl sql and pl pgsql works creat. The easy way todo use it isla lke any query

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #2 on: December 07, 2014, 09:13:27 am »
I use TZQuery and want to start the pl sql script with Query.open
This gives an error on the ":=" in the script. (I will post the error later on)

example, this will not work (And works fine i sql developer)

Code: [Select]
declare
  V_test number;
begin
 v_test := 10;
end;
/


tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: pl sql script
« Reply #3 on: December 07, 2014, 01:05:29 pm »
I think you should try with Query.ExecSQL.
Open is more for datasets.

I would also be cautios about the '/'.
Lazarus 2.0.2 64b on Debian LXDE 10

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #4 on: December 20, 2014, 11:43:48 am »
The slah "/"  is nessecary. It runs the pl/ sql block

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #5 on: December 20, 2014, 10:24:03 pm »
I can't get zoes lib to run a simle emtpy test pl/sql block
I use 7.14 stable

pl/sql (This runs fine in sqlplus and TOAD).:
Code: [Select]
declare
  v_test Number;
begin
  NULL;
END;
/   

i get an error on line 1 position 8.
error message: SQL Error: OCI_ERROR: ORA-06550; Line 1, column 8:
PLS-00103: Symbol "" encounterd

when i change de pl/sql code to:

Code: [Select]
declare v_test Number; begin NULL; END; /

then i get the same warning but at line 1 position 22.

So  it seems to me that the return in the first code and "end of line" in the second code is not excepted.

What is wrong?

miab3

  • Full Member
  • ***
  • Posts: 145

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #7 on: December 21, 2014, 08:49:36 am »
I tried zeos 7.2. Got it from sourceforge yesterday. I installed lazarus compete fresh. I get an acces violation when i start a query. When i replace the zoes component to 7.14 the accea violation is gonne. So it seems i cant install 7.2 right to test the pl/sql

miab3

  • Full Member
  • ***
  • Posts: 145
Re: pl sql script
« Reply #8 on: December 21, 2014, 11:51:25 am »
@Hansvb,

I tried zeos 7.2. Got it from sourceforge yesterday. I installed lazarus compete fresh. I get an acces violation when i start a query.

That's weird. 
To me it never happened.
You write about the version downloaded from the address?:
http://svn.code.sf.net/p/zeoslib/code-0/branches/testing-7.2/

What is your development environment?
(My I list here:
http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=3795&p=36341#p36341)

Michal
« Last Edit: December 21, 2014, 11:58:59 am by miab3 »

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #9 on: December 21, 2014, 03:24:32 pm »
i got it with:
svn checkout svn://svn.code.sf.net/p/zeoslib/code-0/trunk zeoslib-code-0

it is rev 3561

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #10 on: January 09, 2015, 10:31:13 pm »
I am still trying to get pl/sql code to work.

At the end of the sql statement i get a warning: "Symbol '''' found.
This warning always shows at the end of a statement.

Code: [Select]
  with DataModule1.ZQuery_Adress do
      begin
        Close;
        SQL.Clear;
        sql.Add('declare v_test Number; begin NULL; END;' + #13#10);
        ExecSQL;
      end;

Without the #13#10 i get the same warning.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: pl sql script
« Reply #11 on: January 09, 2015, 10:40:46 pm »
@Hansvb - do you have a pl/sql script that returns something?

maybe something like a small stored procedure that is called by the pl/sql script so I can see a returned value on the screen.
I am having Zeos 7.1.4 and 11g and could also test.
Lazarus 2.0.2 64b on Debian LXDE 10

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: pl sql script
« Reply #12 on: January 12, 2015, 09:21:17 am »
I don't have stored procedures. it is just a pl/sql block wtih no functions to test it.


Code: [Select]
declare
v_test Number;
begin
NULL;  --just for testing
END;
/

 

TinyPortal © 2005-2018