How to Migrate T-SQL Stored procedure to Postgres DB of version prior to 11 - postgresql

Is it possible to migrate T-SQL Stored procedure to Postgres database of version prior to 11, in any way? I know CREATE PROCEDURE supported from Postgres V 11 and above. Is there any other way we can achieve the same thing as we do in T-SQL Stored Procedure. We are planning to move to Amazon Aurora which supports Postgress 10.6 now. I am new to Postgres. Any suggestion would be appreciated .

Unsurprisingly, it depends on what you are trying to do. For most things, you will be able to use functions instead of procedures. If your stored procedures require transaction management, though, you won't be able to do that without procedures.

Related

Stored procedure implementation instead of hard coded queries In Postgres

Aurora Postgres 11.9
In SQL Server we strictly follow the good programming practice that "every single call land on DB from the application will be a stored procedure instead of simple queries". In Oracle, we haven't experienced the same thing may be due to select stored procedures required additional cursors, and so on.
Can any expert Postgres person advise me what practice should we follow in progress in this regard and what are pros and cons in this case of Postgres?
In addition in SQL Server we use "rowversion" for data sync with BI and other external modules, is there any built-in alternate available in Postgres or should we have to do it with manual triggers?

Postgres local procedure or local module

I'm porting a stored procedure from Oracle to Postgres 11.
The procedure has a local procedure created inside it and being used multiple times.
I tried creating the same in Postgres but I'm not able to do so.
Is this option not available in Postgres? Thanks in advance.
No, that doesn't exist in PostgreSQL.
But it shouldn't be a problem to make a regular top-level function or procedure out of the nested one.

Recover existing object code in greenplum database

One of my procedure in greenplum database is replaced by a wrong code.I want the old and correct version of the procedure. Is it possible in greenplum database to recover the code?
Is there any function like Flashback in greenplum database?
Greenplum doesn't support many online transactional processing features such as flashback found in Oracle.

How to obtain the database schema from a Sybase ASA 11 Database

I am working on a project where I need to programmatically validate and/or compare a database schema between product releases.
I am using Perl and am looking for a cross-platform method to collect the database schema. I am currently able to perform database queries by utilizing the dbisql.exe command and then parsing the results.
I am wondering if there is potentially a stored procedure or set of queries that I can run to collect the database schema.
It appears that the dbunload.exe command could be used to generate a SQL regeneration script however I am thinking that this output may be difficult to parse.
Any feedback would be greatly appreciated.
If you would like to retrieve the DB schema data on a really low level you could query the corresponding system tables. They are in the SYS-Namespace, especially SYSTABLE (for all tables) and SYSCOLUMN for all fields in those tables.
Check the ASA SQL Reference Handbook for the schema of those system tables.
With Perl's DBI you can easily fire queries on those tables. But you will have to create some local storage for the schema to compare the query results with.
Sybase Central v3.0 has the possibility to export DDL with all DB objects;
and I think SC v6.0 can't connect to ASA 11 :(

Copying Data from Oracle to Postgres

We have a daily process that pulls all data out of a number of tables in an Oracle database and imports them into a Postgress (EnterpriseDB) database - Version 8.4.
We are currently using a java application to select * from each table, change the keywords (date, timestamp, etc) and then import them into the Postgres Database.
Are there any tools available in Postgres that would provide a more efficient manner of doing this? I should note that there are CLOBs that are being transported over.
There is Ora2Pg, which is intended as a one-time-migration tool, but it might work in your case as well. I think of it as an Oracle-to-PostgreSQL pg_dump.