[firebase-br] [Firebase-br]Insert com exception

Tecnobyte Informática temp2 em tecnobyte.com.br
Seg Fev 14 18:01:07 -03 2011


Boa tarde

O comando UPDATE OR INSERT não resolve?

Veja:

  Syntax rules:
    UPDATE OR INSERT INTO <table or view> [(<column_list>)]
        VALUES (<value_list>)
        [MATCHING (<column_list>)]
        [RETURNING <column_list> [INTO <variable_list>]]

  Scope:
    DSQL, PSQL

  Examples:
    1. UPDATE OR INSERT INTO T1 (F1, F2) VALUES (:F1, :F2);
    2. UPDATE OR INSERT INTO EMPLOYEE (ID, NAME) VALUES (:ID, :NAME) 
RETURNING ID;
    3. UPDATE OR INSERT INTO T1 (F1, F2) VALUES (:F1, :F2) MATCHING (F1);
    4. UPDATE OR INSERT INTO EMPLOYEE (ID, NAME) VALUES (:ID, :NAME) 
RETURNING OLD.NAME;

  Notes:
    1. When MATCHING is omitted, the existence of a primary key is required.
    2. INSERT and UPDATE permissions are needed on <table or view>.
    3. If the RETURNING clause is present, then the statement is described 
as
       isc_info_sql_stmt_exec_procedure by the API. Otherwise it is 
described
       as isc_info_sql_stmt_insert.

  Limitation:
    1. A singleton error will be raised if the RETURNING clause is present 
and more than
       one record match the condition.

Daniel P. Guimarães
Tecnobyte Informática
www.tecnobyte.com.br


----- Original Message ----- 
From: "Brayan dos Santos" <brayan.gremista em gmail.com>
To: "FireBase" <lista em firebase.com.br>
Sent: Monday, February 14, 2011 3:21 PM
Subject: [firebase-br] [Firebase-br]Insert com exception


Existe alguma maneira de criar um script de inserção, que em caso de erro,
execute um update, mais ou menos como a clausula try - except do delphi.

Pegunto porque estou atualizando os dados de uma tabela através do comando
DelimitedInputFile, e ele trata todos os comandos de uma vez só no delphi,
ou seja, só posso usar um insert ou um update, não tem como tratar só o que
dá erro, pois ele executa o mesmo comando pra todos os registros contidos no
arquivo txt.

Obrigado.





Mais detalhes sobre a lista de discussão lista