Leandro

Pelo que sei Sim, no Firebird 1.5 tem um recurso chamado EXECUTE
STATEMENT


/* Achei no Release Notes do Firebird */

PSQL (Stored procedure and trigger language)

(1.5) EXECUTE STATEMENT
Alex Peshkov
PSQL extension which takes a string which is a valid dynamic SQL
statement and executes it as if it had
been submitted to DSQL.
Available in triggers and stored procedures.
The syntax may have three forms.

Syntax 1
Executes <string> as SQL operation that does not return any data rows,
viz. INSERT, UPDATE, DELETE,
EXECUTE PROCEDURE or any DDL statement except CREATE/DROP DATABASE.
EXECUTE STATEMENT <string>;
Example
CREATE PROCEDURE DynamicSampleOne (Pname VARCHAR(100))
AS
Firebird 1.5 Release Notes v.1.08 5 February 2004 Page 21
DECLARE VARIABLE Sql VARCHAR(1024);
DECLARE VARIABLE Par INT;
BEGIN
SELECT MIN(SomeField) FROM SomeTable INTO :Par;
Sql = ’EXECUTE PROCEDURE ’ || Pname || ’(’;
Sql = Sql || CAST(Par AS VARCHAR(20)) || ’)’;
EXECUTE STATEMENT Sql;
END

Syntax 2
Executes <string> as SQL operation, returning single data row. Only
singleton SELECT operators may be
executed with this form of EXECUTE STATEMENT.
EXECUTE STATEMENT <string> INTO :var1, […, :varn] ;
Example
CREATE PROCEDURE DynamicSampleTwo (TableName VARCHAR(100))
AS
DECLARE VARIABLE Par INT;
BEGIN
EXECUTE STATEMENT ’SELECT MAX(CheckField) FROM ’ || TableName INTO :Par;
IF (Par > 100) THEN
EXCEPTION Ex_Overflow ’Overflow in ’ || TableName;
END

Syntax 3
Executes <string> as SQL operation, returning multiple data rows. Any
SELECT operator may be
executed with this form of EXECUTE STATEMENT.
FOR EXECUTE STATEMENT <string> INTO :var1, …, :varn DO
<compound-statement>;
Example
CREATE PROCEDURE DynamicSampleThree (
TextField VARCHAR(100),
TableName VARCHAR(100))
RETURNS (Line VARCHAR(32000))
AS
DECLARE VARIABLE OneLine VARCHAR(100);
BEGIN
Line = ’’;
FOR EXECUTE STATEMENT
’SELECT ’ || TextField || ’ FROM ’ || TableName INTO :OneLine
DO
IF (OneLine IS NOT NULL) THEN
Line = Line || OneLine || ’ ’;
SUSPEND;
END
Additonal notes about EXECUTE STATEMENT
The ‘EXECUTE STATEMENT’ DSQL string cannot contain any parameters in any
syntax variation. All
variable substitution into the static part of the SQL statement should
be performed before the
execution of EXECUTE STATEMENT.
Firebird 1.5 Release Notes v.1.08 5 February 2004 Page 22
This feature is intended only for very cautious use and should be used
with all factors taken into
account. It should be a rule of thumb to use EXECUTE STATEMENT only when
other methods are
impossible, or perform even worse than EXECUTE STATEMENT.
EXECUTE STATEMENT is potentially unsafe in several ways:
1. There is no way to validate the syntax of the enclosed statement.
2. There are no dependency checks to discover whether tables or columns
have been dropped.
3. Operations will be slow because the embedded statement has to be
prepared every time it is
executed.
4. Return values are strictly checked for data type in order to avoid
unpredictable type-casting
exceptions. For example, the string ’1234’ would convert to an integer,
1234, but ’abc’ would give
a conversion error.
5. If the stored procedure has special privileges on some objects, the
dynamic statement submitted in
the EXECUTE STATEMENT string does not inherit them. Privileges are
restricted to those granted to
the user who is executing the procedure.


Acha que da pra ter uma ideia?

Atenc.

Elazar;


-----Mensagem original-----
De: delphi-br@yahoogrupos.com.br [mailto:[EMAIL PROTECTED]
Em nome de Leandro Carbonera
Enviada em: quinta-feira, 3 de novembro de 2005 07:00
Para: delphi-br@yahoogrupos.com.br
Cc: FireBase
Assunto: [delphi-br] Criar usuario no IB/FB atraves de instrução SQL




E ai companheiros, tudo tranquilo..........

Alguem sabe me dizer se existe no Interbase/FireBird como criar um
usuario atraves de instrução SQL diretamente no Banco, por um trigger ou
stored procedure???????

Att.

Leandro Carbonera
Suporte Técnico - RBR Informática

Fone: 54 343 1788
[EMAIL PROTECTED]
www.rbrinformatica.com.br


        

        
                
_______________________________________________________ 
Yahoo! Acesso Grátis: Internet rápida e grátis. 
Instale o discador agora!
http://br.acesso.yahoo.com/



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>


 
Links do Yahoo! Grupos




 



        

        
                
_______________________________________________________ 
Yahoo! Acesso Grátis: Internet rápida e grátis. 
Instale o discador agora!
http://br.acesso.yahoo.com/



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

<*> Para ver as mensagens antigas, acesse:
    http://br.groups.yahoo.com/group/delphi-br/messages

<*> Para falar com o moderador, envie um e-mail para:
    [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a