[Dica] Padrões de ON-ERROR,ON-MENSAGEM, KEY-EXIT etc

Dicas do Oracle Forms Builder - Blocos, Itens, LOV, Canvas, Triggers, comandos, PLL, d2kwutil, FMB, Alert, menus, etc
Responder
Hahu
Rank: Analista Sênior
Rank: Analista Sênior
Mensagens: 147
Registrado em: Qui, 16 Mar 2006 11:26 am
Localização: São Paulo
O mundo gira muito!!

bom dia amigos,

colocar no gatilho do forms:
--- on-error
begin

Selecionar tudo

  if error_code = 40100 then
     MESSAGE ( 'ESTE E O PRIMEIRO REGISTRO');
  elsif error_code = 40102 then
     MESSAGE ( 'não há MAIS REGISTROS');
  elsif error_code = 40200 then
     MESSAGE ( 'TECLA INVALIDA');
  elsif error_code = 40202 then
     MESSAGE ( 'CAMPO OBRIGATORIO');
  elsif error_code = 40204 then
     MESSAGE ( 'ESTA E A PRIMEIRA POSICAO DO CAMPO');
  elsif error_code = 40207 then
     MESSAGE ( 'VALOR INVALIDO PARA ESTA OPERACAO');
  elsif error_code = 40209 then
     MESSAGE ( 'CAMPO INVALIDO');
  elsif error_code = 40356 then
     MESSAGE ( 'CARACTER INVALIDO');
  elsif error_code = 40401 then
     MESSAGE ( 'não há MUDANCAS PARA SEREM GRAVADAS');
  elsif error_code = 40405 then
     null;   /* post */
  elsif error_code = 40508 then
     MESSAGE ( 'REGISTRO IMPROPRIO PARA INSERCAO');
  elsif error_code = 40735 then
     null;   /* value error */
  elsif error_code = 41000 then
     MESSAGE ( 'ESTA FUNCAO não E PERMITIDA NESTE MODO');
  elsif error_code = 41004 then
     MESSAGE ( 'ESTA FUNCAO não E PERMITIDA NESTE MODO');
  elsif error_code = 50012 then
     MESSAGE ( 'DATA INVALIDA');
  elsif error_code = 50013 then
     MESSAGE ( 'CARACTERE INVALIDO');
  elsif error_code = 50014 then
     MESSAGE ( 'CARACTERE INVALIDO');
  elsif error_code = 50024 then
    bell;
    MESSAGE ( 'DADOS INVALIDOS');
  elsif error_code = 50016 then
     MESSAGE ( 'CARACTERE INVALIDO');
  else
     MESSAGE ( TO_CHAR(ERROR_CODE)||' - '||ERROR_TEXT);
  end if;
  if error_code not in(40405, 40735) then
     bell;
  end if;
  raise form_trigger_failure;
end;

--on-message

Selecionar tudo


begin
  if message_code = 40301 then
     MESSAGE ( 'REGISTRO não ENCONTRADO');
  elsif message_code = 40352 then
     MESSAGE ( 'ULTIMO REGISTRO RETORNADO');
  elsif message_code = 40353 then
     null;    /* cancelamento de enter_query */
  elsif message_code = 40400 then
     null;   /* commit */
  elsif message_code = 40404 then
     null;   /* post */
  elsif message_code = 50024 then
    bell;
    MESSAGE ( 'DADOS INVALIDOS');
  elsif message_code = 40406 then
     null;   /* post */
  elsif message_code = 40407 then
     null;   /* post */
  elsif message_code = 41800 then
     MESSAGE ( 'não há LISTA DE VALORES ATIVA PARA ESTE CAMPO');
  else
     MESSAGE ( to_char(message_code)||' - '||message_text);
  end if;
  if message_code not in(40353, 40400, 40404, 40406, 40407) then
     bell;
  end if;
end;

-- when-new-form-instance

Selecionar tudo


BEGIN
  SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,WINDOW_STATE,MAXIMIZE);
  SET_WINDOW_PROPERTY('page_1',WINDOW_STATE,MAXIMIZE) ;
  SHOW_VIEW('page_1');
  GO_ITEM('nome_item');
  GO_BLOCK('nome_bloco');
  GO_ITEM('nome_item');
  
END;
-- key-exit

Selecionar tudo


begin
	clear_block(no_validate);
	exit_form;
end;
*** amigos, disponibilizei este padrões para ajudar no momento do aperto, isto ocorreu comigo em um dia com mta pressão e não tendo onde recorrer..rs!

abs de seu amigo Hahu ;)
Responder
  • Informação