Fórum Conversão: código delphi -gt; stored procedure #352817
31/01/2008
0
No Delphi eu tenho a seguinte expressão:
sql.text := ´ update ´+fTabela+´ set ´+ ´ jahretornou = ´+inttostr(fMarca)+ ´ where codigo = ´+inttostr(fCod);
E na stored procedure, tentei fazer a mesma coisa:
CREATE or ALTER PROCEDURE SP_UpdateEhRetorno ( FCOD INTEGER, FMARCA INTEGER, FTABELA VARCHAR(50)) AS begin update :fTabela set jahretornou = :fMarca where codigo = :fCod; end;
Porém dá erro na coluna 12, que é o parâmetro [b:f87b1fc00b]:fTabela[/b:f87b1fc00b] .
Se alguém puder me ajudar ...
Valeu ! :!:
Powerlog Tecnologia
Curtir tópico
+ 0Posts
31/01/2008
Flyskin
se estiver utilizando o oracle, pode criar um código pl/sql buscando o nome da tabela nos objetos do banco.
Gostei + 0
01/02/2008
Powerlog Tecnologia
Será que tem alguma coisa do gênero
igual no Delphi, quando usamos, por exemplo, TEdit(sender) ???
Só chutômetro...
Gostei + 0
01/02/2008
Djjunior
Só chute....
Gostei + 0
01/02/2008
Powerlog Tecnologia
Gostei + 0
01/02/2008
Djjunior
Procedure do banco
procedure tabName, campo, condicao: varchar(20) var instrucao; begin instrucao = ´Select ´+ campo + ´ from ´ + tabName; if condicao <> ´´ then instrucao = instrucao + ´ where ´ + condicao; exec instrucao end;
Gostei + 0
01/02/2008
Powerlog Tecnologia
Gostei + 0
01/02/2008
Pestana_
ex.:
set term ^ ; create procedure teste_procedure ( nomeTabela varchar(40), nomeCampo varchar(40), id integer, returns (data date) as declare variable codigo integer; begin strSql = ´SELECT id FROM ´ || :nomeTabela || ´ WHERE ´ || :nomeCampo || ´ = ´ || :id; execute statement :strSql into :codigo; end ^ set term ; ^
flw
Gostei + 0
01/02/2008
Pestana_
CREATE or ALTER PROCEDURE SP_UpdateEhRetorno ( FCOD INTEGER, FMARCA INTEGER, FTABELA VARCHAR(50)) AS DECLARE VARIABLE strSql varchar(500); begin strSql = update :fTabela set jahretornou = :fMarca where codigo = :fCod; execute statement :strSql end;
flw.
Gostei + 0
01/02/2008
Powerlog Tecnologia
Era isso que eu precisava
:!:
Gostei + 0
01/02/2008
Pestana_
qualquer coisa posta aqui no forum!
flw.
Gostei + 0
01/02/2008
Powerlog Tecnologia
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)