Skip navigation

Hello Everybody

 

Oracle ADF could use Oracle JET to implement CRUD operations on top of ADF BC.

 

Here is a start of series

Andrejus Baranovskis Blog: Oracle JET CRUD - Search and Edit Form - Part I

 

I hope that helps someone.

 

Regards

Mahmoud

Hello Everybody

 

If you face INTERNAL SERVER ERROR and you did your best with DEBUG entries but with no result.

 

There is a big hope in ADVISOR.

 

Regards

Mahmoud

Hello Everybody

 

Based on this brilliant PHP class

https://www.phpclasses.org/package/5453-PHP-Validate-Saudi-resident-identifier-numbers.html

 

I searched the internet for PL/SQL code that achieves that but I didn't find. Here is another nice validator in multiple languages except PL/SQL.

https://github.com/alhazmy13/Saudi-ID-Validator

 

That is why I wrote, PL/SQL function to validate Saudi ID/Iqama/Residence number

CREATE OR REPLACE FUNCTION is_number (p_string IN VARCHAR2)
  RETURN INT
IS
  v_num NUMBER;
BEGIN
  v_num := TO_NUMBER(p_string);
  RETURN 1;
EXCEPTION
WHEN VALUE_ERROR THEN
  RETURN 0;
END is_number;
/

create or replace FUNCTION  "CHECKSTDID" (STDID in VARCHAR2) return number is  
  Result number; -- 1 --> Saudi , 2 --> Non-Saudi , 0 --> Invalid  
  ZF0dd  varchar2(100);  
  mysum    number := 0;  
  idtype varchar2(1);  
begin  
      
    -- If non-numeric then invalid  
    If ( is_number(STDID)=0 ) THEN  
       Result := 0;
       return Result;  
    END If;  
      
    --If length does not equal 10 then invalid  
    If(LENGTH(STDID) != 10) THEN  
       Result := 0;  
       return Result;  
    END IF;  
      
    -- get type  
    idtype := substr(STDID,1,1);  
      
    -- ID TYPE should be one or 2 only  
    --If length does not equal 10 then invalid  
    If(idtype not in ('1','2')) THEN  
       Result := 0;  
       return Result;  
    END IF;  
      
    -- you must do mapping between PHP's substr and PL/SQL's substr  
    for i in 0..9  
    loop  
      if ( Mod(i ,2) = 0 )then  
          ZF0dd := LPad( TO_NUMBER(substr(STDID,i+1,1))*2 , 2, '0');  
          mysum := mysum + TO_NUMBER(substr(ZF0dd,1,1)) + TO_NUMBER(substr(ZF0dd,2,1));       
      else  
          mysum := mysum + TO_NUMBER(substr(STDID, i+1 , 1 ));               
      end if;  
    end loop;  
      
    -- find result  
    if Mod(mysum,10) != 0 then  
      Result := 0;  
    else  
       Result := TO_NUMBER(idtype);  
    end if;  
      
    return(Result);  
end;  

 

I hope that helps someone

 

Regards

Mahmoud

Goal:

Tracking of user activities by getting his/her IP is useful. However, it would be great if we find the location where he/she is coming from.

 

To get the IP of the client you could use this PL/SQL code

OWA_UTIL.get_cgi_env('X-Forwarded-For')

 

The Geolocation is not offered by any Oracle PL/SQL function. That's why we could use a nice free RESTful API to catch it. I wrote a function for that

create or replace FUNCTION  "GEOLOCATION" (p_ip in VARCHAR2) return CLOB is
    base_url varchar2(150);
    l_clob CLOB;
begin
    base_url := 'http://ip-api.com/json/' || p_ip;    
    
    /* RABIE: GET Request */
    l_clob := APEX_WEB_SERVICE.make_rest_request(
        p_url         => base_url,    
        p_http_method => 'GET'
    );
      
    /*RABIE: return value (TODO: should return the result from the server)*/
    return l_clob;
    
end;

 

I hope that helps someone

 

Regards

Mahmoud

Hello Everybody

 

Auditing is very important for any system.

 

Sven wrote a nice blog post about creation of AUDIT columns.

https://svenweller.wordpress.com/2016/02/24/sequence-and-audit-columns-with-apex-5-and-12c/

 

No need for TRIGGERs and the performance is better.

 

Enjoy reading!

 

Regards

Mahmoud

Goal:

Although Oracle APEX 18.1 supports Social Sign-In. However, getting the profile of google account is not straight-forward. In the below thread, I provided the solution.

 

If you want to implement Social Sign-In with Google account and then return your Google Plus Profile data and image using APEX 18.1, then I would recommend reading this interesting thread and see how it is solved.

Re: How to get & parsing the JSON response of Social Sign-In (APEX 18.1)

 

Have a nice time

 

Regards

Mahmoud