CPF validation

Oracle Application Express - web application development tool (antigamente conhecido como Oracle HTML-DB)
Post Reply
junior.silva
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Mon, 10 Jun 2013 4:29 pm

Good afternoon staff,
I created a valid_cpf function that returns 0 (zero) to invalid CPF and 1 for valid CPF.
Then I created a field validation in the CPF of my form.
Validation has the following characteristics.
Type: The specified item / column is numeric
The Validation Expression field 1 (# value_required #)

Select all

select valida_cpf(:cpf) from dual;
The Error Message field (# value_required #)
CPF invalid!

How should I proceed to compare the function return and when the CPF is invaled the system displays the message?
senaha.ricardo
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 12
Joined: Tue, 07 May 2013 11:35 am

Junior,

to make a function call, you can do this in an anonymous block to test, using begin and end ...

use the dbms_output.put_line To display the return value of your Function.
junior.silva
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Mon, 10 Jun 2013 4:29 pm

Ricardo,
and how should I proceed to compare this return and not allow the user to confirm the registration?
senaha.ricardo
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 12
Joined: Tue, 07 May 2013 11:35 am

Junior,
Can I take a look at your code to see how can I help you?
junior.silva
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Mon, 10 Jun 2013 4:29 pm

Good morning Ricardo,
As you had told me I tried to use dbms_output.put_line but nothing happens.

Select all

declare 
  vexception  exception; 
  nReturn NUMBER; 
begin 
   nReturn := select VALIDA_CPF_CNPJ(:P4_CPFCNPJ) from dual; 
  if (nReturn = 0) then 
     raise vexception; 
  end if; 
exception 
  when vexception then 
    dbms_output.put_line('invalido'); 
end;
I wanted to send you a print of the screen where I inform the field rules to check if I'm doing something wrong also in the configuration of the field validation but I do not know what's going on .
Thanks for your patience hehehe!
junior.silva
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Mon, 10 Jun 2013 4:29 pm

Follows a print of the configuration screen
Attachments
Tela de validação do campo
Tela de validação do campo
junior.silva
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Mon, 10 Jun 2013 4:29 pm

I found the problem Ricardo
Thanks for the attention!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests