Good afternoon guys,
Thanks for opening this space for help. Come on
I need to do a when-validate-item in three fields that I have in my forms. The fields are as follows well, carc and branch of the table
branch_carac_bem_segurado. At the time that will use you type verify if it exists in the table, if it exists let me insert, if not from MSG speaking that does not exist. As I am a beginner I am finding difficulties, if someone can give me a light.
gratoo
Lelo
When-validate-item
-
- Rank: Programador Pleno
- Posts: 36
- Joined: Mon, 17 Aug 2009 11:02 am
- Location: Gaspar-SC
Jeziel Peres
PL/SQL - Forms 6i
PL/SQL - Forms 6i
It makes a condition in this validate in which Verefica on the table ... or Nesao assembles your condition in a procedure and only calls it in the validity.
creates a procedure where in it you do the select with any conditions and then just calls this procedure in the validate.
If it is not really this your difficulty speaks, try to explain better and post aqui your current code.
creates a procedure where in it you do the select with any conditions and then just calls this procedure in the validate.
If it is not really this your difficulty speaks, try to explain better and post aqui your current code.
Jeziel,
Thanks for help.
Now it even cleared, but it turns out that my code is not funny, it's not validating anything in the field, can you check what I'm wrong?
follows
If you can help me !!!
Gratooo
Lelooo
Thanks for help.
Now it even cleared, but it turns out that my code is not funny, it's not validating anything in the field, can you check what I'm wrong?
follows
begin
select count(1)
into :radesc.cd_tipo_bem_segurado
from RAMO_CARAC_BEM_SEGURADO
where cd_tipo_bem_segurado = :radesc.cd_tipo_bem_segurado;
exception
when no_data_found then
mensagem ('Tipo Bem Segurado não Cadastrado.');
raise form_trigger_failure;
when others then
mensagem ('Problemas ao Selecionar Registro em TIPO_BEM_SEGURADO. Erro: '||sqlerrm||' - (when-validate-item - controle.cd_tipo_bem_segurado).');
raise form_trigger_failure;
end;
Gratooo
Lelooo
Face using count, will never give when no_data_found, porque to fall in this error and lock the program, have to come back null in your select and using the count will never return null, at most 0 .... alias, so no need to use Exception with a Select count ...
I did not understand why you played the select result in the place of the value that you typed on the screen and you used it on the wher.
It would be interesting to declare a variable ... Thus:
I did not understand why you played the select result in the place of the value that you typed on the screen and you used it on the wher.
It would be interesting to declare a variable ... Thus:
Declare
aux number;
Begin
select count(*) into aux
from RAMO_CARAC_BEM_SEGURADO
where cd_tipo_bem_segurado = :radesc.cd_tipo_bem_segurado;
if aux = 0 then
mensagem ('Tipo Bem Segurado não Cadastrado.');
raise form_trigger_failure;
end if;
end;
-
- Rank: Oracle Guru
- Posts: 448
- Joined: Tue, 16 Jun 2009 3:07 pm
- Location: Parobé - RS
Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS
[]s
Programador Junior
Parobé RS
[]s
It does not make a SELECT INTO, in a block field, even because you do not need it.
should work, if error occurs, post in forms.
declare
cursor c_teste is
select 1
from RAMO_CARAC_BEM_SEGURADO
where cd_tipo_bem_segurado = :radesc.cd_tipo_bem_segurado;
begin
open c_teste ;
if c_teste%notfound then
mensagem ('Tipo Bem Segurado não Cadastrado.');
raise form_trigger_failure;
end if;
close c_teste;
exception
when others then
mensagem ('Problemas ao Selecionar Registro em TIPO_BEM_SEGURADO. Erro: '||sqlerrm||' - (when-validate-item - controle.cd_tipo_bem_segurado).');
raise form_trigger_failure;
end;
Personal,
Thank you for help until now.
It turns out that neho of the two funfo I do not know the reason.
I have 3 fields well, Cara and branch of the branch_carac_bem_segurado table.
I need to insert the information in the Forms field, verify that it is valid in the bank, for example:
Inserts branch 1, if validated leaves Insert, otherwise the message notifying that there is no branch, and do for the other fields também.
Some simple suggestion so that besides making I can understand.
gratoo
Leloooo
Thank you for help until now.
It turns out that neho of the two funfo I do not know the reason.
I have 3 fields well, Cara and branch of the branch_carac_bem_segurado table.
I need to insert the information in the Forms field, verify that it is valid in the bank, for example:
Inserts branch 1, if validated leaves Insert, otherwise the message notifying that there is no branch, and do for the other fields também.
Some simple suggestion so that besides making I can understand.
gratoo
Leloooo
-
- Rank: Oracle Guru
- Posts: 448
- Joined: Tue, 16 Jun 2009 3:07 pm
- Location: Parobé - RS
Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS
[]s
Programador Junior
Parobé RS
[]s
What happened??? What was the mistake that trigger fired ???
-
- Rank: Programador Pleno
- Posts: 36
- Joined: Mon, 17 Aug 2009 11:02 am
- Location: Gaspar-SC
Jeziel Peres
PL/SQL - Forms 6i
PL/SQL - Forms 6i
So put a clause preventing it there ... there shows the message, then put a clause that prevails the user from performing this function ...
This message has q of the only when he commits or when he Inserts the data ???
This message has q of the only when he commits or when he Inserts the data ???
-
- Rank: Programador Pleno
- Posts: 36
- Joined: Mon, 17 Aug 2009 11:02 am
- Location: Gaspar-SC
Jeziel Peres
PL/SQL - Forms 6i
PL/SQL - Forms 6i
You showing that it is registered or not registered or may or may not register, a user who has already a table.
This means that confused this. Try it to be clearer .. from which you messages you to bar the registration user?
This means that confused this. Try it to be clearer .. from which you messages you to bar the registration user?
-
- Rank: Oracle Guru
- Posts: 448
- Joined: Tue, 16 Jun 2009 3:07 pm
- Location: Parobé - RS
Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS
[]s
Programador Junior
Parobé RS
[]s
Dude if you think the problem is in the function that treats the mistakes, then put it in the forum, or comment where it is clinging call and checks if it will treat.
I want you to type the user type and try to move to the next field, display the message Senao exists.
has this function that treats errors follows, and by the way there is some screens:
]] Thank you for help for help
has this function that treats errors follows, and by the way there is some screens:
FUNCTION ERROS (TIPO_ERRO IN VARCHAR2,
CODIGO_ERRO IN NUMBER,
TEXTO_ERRO IN VARCHAR2)
RETURN VARCHAR2 IS
V_MENSAGEM VARCHAR2(300) := TEXTO_ERRO;
BEGIN
IF CODIGO_ERRO = 40100 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Primeiro registro.';
ELSIF CODIGO_ERRO = 40102 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Registro deve ser informado ou excluido.';
ELSIF CODIGO_ERRO IN (40200, 41008) THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Campo protegido contra atualização.';
ELSIF CODIGO_ERRO = 40202 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Campo deve ser informado.';
ELSIF CODIGO_ERRO = 40207 and substr(V_MENSAGEM,1,16) = 'Must be in range' THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||replace(V_MENSAGEM, 'Must be in range', ' Valor deve estar entre');
V_MENSAGEM := replace(V_MENSAGEM, 'to', 'e');
ELSIF CODIGO_ERRO = 40209 and substr(V_MENSAGEM,1,21) = 'Field must be of form' THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||replace(V_MENSAGEM, 'Field must be of form', ' Campo deve respeitar o formato de');
ELSIF CODIGO_ERRO = 40212 and substr(V_MENSAGEM,1,23) = 'Invalid value for field' THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||replace(V_MENSAGEM, 'Invalid value for field', ' Valor inválido para o campo');
ELSIF CODIGO_ERRO = 40401 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Não há transações para serem efetivadas.';
ELSIF CODIGO_ERRO = 40501 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Registro não poderá ser alterado ou excluído, pois está sendo alterado por outro usuário.';
ELSIF CODIGO_ERRO = 40508 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' ERRO ORACLE: Problema ao inserir um registro. Favor entrar em contato com o suporte.';
ELSIF CODIGO_ERRO in (41000, 41009) THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Função não disponível.';
ELSIF CODIGO_ERRO = 41051 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Proibida a criação de registros.';
ELSIF CODIGO_ERRO = 41830 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Lista de Valores não contém dados.';
ELSIF CODIGO_ERRO = 41049 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Registro Não pode ser Excluído';
ELSIF CODIGO_ERRO = 40702 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Favor SALVAR ou CANCELAR as alterações feitas antes de mudar de tela';
ELSIF CODIGO_ERRO = 40403 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Esta transação não pode ser Salvada pois há telas anteriores que ainda NÃO foram salvas!. Sair SEM SALVAR desta tela e salvar primeiro as telas pendentes!.';
ELSIF CODIGO_ERRO IN (40358, 50002, 50003, 50004) THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Data Inválida.';
ELSIF CODIGO_ERRO = 40509 THEN
if substr(get_application_property (CURRENT_FORM_NAME),1,4) = 'SINI' then
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Erro ao atualizar. Tabela pode não existir ou falta privilégio p/processar operação. Clique em <SHIFT> + <F1> p/verificar o erro e contacte a equipe da SIMETRIAS.(Ramal 7651)';
else
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Erro ao atualizar. Tabela pode não existir ou falta privilégio p/processar operação. Clique em <SHIFT> + <F1> p/verificar o erro e contacte a área de SISTEMAS(Ramais 7651,7647 e 7652).';
end if;
ELSIF CODIGO_ERRO IN (40356, 50016) THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Conteúdo Inválido para Campo Numérico.';
ELSIF CODIGO_ERRO = 50025 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Dia e Hora devem ser informados no seguinte formato : DD/MM/AAAA HH:MI.';
ELSIF CODIGO_ERRO = 28000 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Tentativa de conexão bloqueada. Para desbloqueio, comunicar-se c/Depto Sistemas (7651, 7652, 7647). Se o erro não foi da sua digitação, checar quem está tentando utilizar a sua senha.';
ELSIF CODIGO_ERRO = 50026 THEN
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||':'||' Campo deve respeitar o formato de dd/mm/yyyy.';
ELSE
V_MENSAGEM := TIPO_ERRO||'-'||TO_CHAR(CODIGO_ERRO)||' '||TEXTO_ERRO;
END IF;
RETURN(V_MENSAGEM);
END;
-
- Rank: Oracle Guru
- Posts: 448
- Joined: Tue, 16 Jun 2009 3:07 pm
- Location: Parobé - RS
Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS
[]s
Programador Junior
Parobé RS
[]s
I doubt much that this function is your problem.
Do the following:
Display the result of your SELECT:
Do the following:
Display the result of your SELECT:
declare
cursor c_teste is
select 1
from RAMO_CARAC_BEM_SEGURADO
where cd_tipo_bem_segurado = :radesc.cd_tipo_bem_segurado;
begin
open c_teste ;
if c_teste%notfound then
mensagem ('Tipo Bem Segurado não Cadastrado.');
raise form_trigger_failure;
else
mensagem ('Achei');
end if;
close c_teste;
exception
when others then
mensagem ('Problemas ao Selecionar Registro em TIPO_BEM_SEGURADO. Erro: '||sqlerrm||' - (when-validate-item - controle.cd_tipo_bem_segurado).');
raise form_trigger_failure;
end;
[code]
-
- Rank: Oracle Guru
- Posts: 448
- Joined: Tue, 16 Jun 2009 3:07 pm
- Location: Parobé - RS
Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS
[]s
Programador Junior
Parobé RS
[]s
If I find it, he can insert.
-
- Rank: Programador Pleno
- Posts: 36
- Joined: Mon, 17 Aug 2009 11:02 am
- Location: Gaspar-SC
Jeziel Peres
PL/SQL - Forms 6i
PL/SQL - Forms 6i
declare
cursor c_teste is
select cd_tipo_bem_segurado
from RAMO_CARAC_BEM_SEGURADO
where cd_tipo_bem_segurado = :radesc.cd_tipo_bem_segurado
and ROWNUM = 1;
begin
open c_teste ;
if c_teste%notfound then
mensagem ('Tipo Bem Segurado não Cadastrado.');
raise form_trigger_failure;
else
mensagem ('Achei');
end if;
close c_teste;
exception
when others then
mensagem ('Problemas ao Selecionar Registro em TIPO_BEM_SEGURADO. Erro: '||sqlerrm||' - (when-validate-item - controle.cd_tipo_bem_segurado).');
raise form_trigger_failure;
end;
Despite being very much like Sergio and maybe do the same function, tests this because if não is that I really know what you want! !!!!!!!!!!
Thank you very much, help from you was real importance !!!
The problem was in an old triggers here they had, and as I am new in the area and also in the company did not know.
But these last two SELECTS helped me !!!
valeu
T +
The problem was in an old triggers here they had, and as I am new in the area and also in the company did not know.
But these last two SELECTS helped me !!!
valeu
T +
-
- Information
-
Who is online
Users browsing this forum: Bing [Bot] and 1 guest