Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to create dynamic procedures

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the company in that work, a component was created in delphi 7 that creates dynamic procedures in any database type, but as it uses BDE and this has limitation. I am migrating for java and I already get to create procedures,
but when the procedure has comments happens the syntax mistake in the reading of the string of the procedure.

EX1: right procedure (MSSqlServer)
----------------------------------------------------------

create procedure spte0001
the
begin
select job_id, job_desc from jobs order by job_id
end
go

EX2: wrong procedure (MSSqlServer)
----------------------------------------------------------
create procedure spte0001
the
begin
--simple test de comentario
select job_id, job_desc from jobs order by job_id
end
go

How can I solve this problem?
 
Yu Tao
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mabe you try like this

create procedure test1
...........
create procedure test2
...........
create procedure control
@varchar(10) str;
begin
if(str='right code'){
call test1;
}else{
call test2;
}
END
go

do you understand???
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sergio,

a component ... that creates dynamic procedures in any database type

Wow, you mean it can create stored procedures for all these databases:
Informix
PostgreSQL
MySQL
SQL Server
Oracle
Sybase
(and all the other databases -- that support stored procedures -- that aren't in the above list?)
I'm impressed. But I'm also curious as to how you accomplish that, since each database has its own proprietary syntax for writing stored procedures -- which already seems to be giving you problems when it comes to writing comments.

Good Luck,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic