Home converting postgresql functions to oracle
Reply: 0

converting postgresql functions to oracle

user1011
1#
user1011 Published in April 21, 2018, 3:25 pm

I need to support postgresql and oracle in the product that I work in. When we install our db on oracle, we do not give privilege of "create type". So I am unsure as to how I can convert following two cases to oracle:

  1. Function That returns array

         create or replace function get_array_of_integers(i_param int)
     returns integer[] as
     $body$
     declare array_of_integers int[];
     begin
    
        select
           case 
              when i_param = 1 then
                 array[1]
              when i_param = 2 then
                 array[1, 2, 3, 4]
              when i_param = 3 then
                 array[5, 6]
              else
                 array[]::integer[]
        end into array_of_integers;
    
        return array_of_integers;
    
     end;
     $body$
     language 'plpgsql' volatile
     cost 100;
    

Second case: function that accepts array of integers:

create or replace function some_function(params int[])
 ...

Thanks in advance!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.249711 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO