equivalent of pragma autonomous_transaction of Oracle in postgres - oracle

In oracle there is a built in way to make a transaction autonomous, but in Postgres there is none (still, as far as I know). What should one do in pl/pgsql code to make an equivalency of autonomous transaction functionality in Postgres? Any hack or by pass in coding guide would be helpful. Thanks.

Currently, the way to do this is to use a connection from the database to itself with the dblink contrib module.

Related

Postgres and oracle in one project

In my project, I should receive data from the oracle and after processing it, write it to postgres, in my case, I need to use mybatis to communicate with the database. Can I connect to different databases in one project?(Postgres, Oracle) Have you faced such a situation?
If so, how do configure the datasourse? I need advice, thanks in advance. It will be great to see code examples

Does impala support database cursors?

I' trying to implement server-side paging. Database cursor looks like a good approach for this. Does Impala supports database cursors like relational databases? The documentation does not explicitly mention that it does or does not.
Here is the official recommendation of doing paging in impala. Short answer : no cursor support. And there isn't a cursor feature in the near dev roadmap either.

Porting application which uses Oracle mod_plsql to PostgreSQL

I need to port an application that uses Oracle mod_plsql to PostgreSQL. Currently database procedures are called over HTTP with the use of Apache + mod_plsql. The procedures are easily ported to PostgreSQL, but I can not find a replacement for the Apache + mod_plsql part. Does anybody have any experience on ho to do it and what to use?
UPDATE (to make stuff more clear):
See: http://docs.oracle.com/cd/B14099_19/web.1012/b14010/concept.htm for how mod_plsql work.
What I need is a way to call a function on postgrsql as:
protocol://hostname[:port]/DAD_location/[[!][schema.][package.]proc_name[?query_string]]
ei:
http://www.acme.com:9000/pls/mydad/mypackage.myproc?a=v&b=1
You could fork my NodeJS based implementation of web_plsql as a starting point and "simply" replace the Oracle access with PostgreSQL.
You should be able to use pretty much all of the logic in NodeJS and only need to change the way how the code interacts with the database in the oracle.js module.

Oracle DDL export

I am trying to recreate an oracle database in an HSQL database.
this is to enable better unit testing on the local developer systems.
What I need to know is is there anything tool/command I can use in the oracle server/client, that can provide me all the DDL commands for all the objects (tables, synonyms, views etc) in the oracle database.
I am planning to go through the created DDL commands and try to convert these commands into HSQL compatible commands.
Is it possible?
Any suggestions will be welcome.
system information:
Oracle DB: Oracle enterprise server 11g R2.
HSQL DB: hsql 2.2.9
You can use the DBMS_METADATA package along with the data dictionary to generate the DDL for your objects. For example, to generate the DDL for every table in a schema
declare
l_ddl clob;
begin
for t in (select * from user_tables)
loop
l_ddl := dbms_metadata.get_ddl( 'TABLE', t.table_name, USER );
<<do something with l_ddl>>
end loop;
end;
Are you sure that it makes sense to test with a completely different database than what you're really going to deploy to? Even if you translate the DDL to the closest analogue, it seems very likely that you'll get different results for some tests depending on the database you're connected to. Are you sure that you can't install Oracle (potentially Oracle XE if your concerns are primarily about licensing) on the developer's machines?
There are quite a few products that can help.
OpenSource:
http://www.liquibase.org/manual/formatted_sql_changelogs
Commercial with free trial:
http://www.devart.com/dbforge/oracle/schemacompare/new-export-oracle-schema.html
If you use a tool that is generally designed for use with Oracle databases only, you may get quite a lot of non-standard Oracle DDL that needs converting. A cross platform tool is more likely to reduce the work.
When HSQLDB is used in the ORA compatibility mode, it can translate some Oracle types in the DDL to a similar SQL Standard type. So the types may not pose a problem.
One open source inactive project do exact same thing.
http://schemamule.sourceforge.net/index.html

Migrating Stored Procedure from PostgreSQL to Oracle

I would like to migrate the Stored Procedure from PostgreSQL to Oracle, can someone suggest me a free tool for doing it ?
Well, SQLDeveloper is free.
But really, if you are moving code from postgresql to oracle, more than likely it's not a simple matter for exporting and importing; you will need to do some coding.

Resources