String Aggregation that works in both oracle and postgresql - oracle

I was originally using LISTAGG to do the union of strings in oracle.
Searching for PostgreSQL I get: string_agg
I don't know if there is any way to have a function that works in both applications.
I have to do it from the query since I can't create functions
thanks for your help

Thank you all for the help, in the end I did it through functions and sub-query

Related

The soundex function from oracle has a result different from official documentation

Following this documentation from oracle.
The example select soundex('SACHS' from dual; should be return S200, but I received S220 in many different oracle version.
Anyone have any idea?
Thanks and best regards!

OPENROWSET for Oracle

Could anybody help me translate this query from T-SQL to PLSQL, please?
I am using SQL Developer.
UPDATE schema.Table SET PICTURES =(SELECT * FROM OPENROWSET (BULK '\\shared folder\Picture.jpg', SINGLE_BLOB) a) WHERE (personID = 1111)
Thank you!
It looks to me like you are trying to apply a single image to a single person table row by selecting from an image file external to the database.
If my understanding is correct then I suggest you investigate Oracle EXTERNAL TABLE, DIRECTORY object and DBMS_LOB package.
Using some variant of these will certainly provide the solution you need.

What is the DB2 equivalent of DUMP function in Oracle?

The dump function in Oracle displays the character set and bitwise representation of how data is stored.
Does anybody know if there is an equivalent command in DB2 please? Thank you.
Using the following query and the functions below up might be able to come up with a UDF to do what you need.
SELECT NAME, VALUE
FROM SYSIBMADM.DBCFG
where NAME in ('codepage','codeset','collate_info')
BITAND
BITOR
BITXOR
BITNOT
BITANDNOT

Sybase Features

Does anybody know if Common Table Expressions and User-defined functions (not from Java) are supported on Sybase 12.5? I'm trying but could not seem to make these work. Thanks guys.
Both are not supported by ASE 12.5
You can use stored procedure instead of functions. I am not sure about what you are referring to by saying common table expressions
Sorry I have to disagree. Microsoft SQL Server is based on Sybase 7.0. So there may not be Common Table Expressions and User-Defined Functions, there are equivalent ways to do the same thing.
For example CTE can be done either in nested queries or via temp tables using a number sign (#) in front of the table name.
For User Defined Functions, create a stored procedure with simple SQL code and call it via the exec function for example "exec my_sql_code". This allows nesting of stored procedures.
Good SQL, good night.

how to make query in Oracle - like Access

In access I can make a query (1) that returns something
and make another query (2) that uses the first query (1).
How I can do it in Oracle 11g ?
thanks in advance
I am not an expert in Oracle but you should check out Views and Nested Views in Oracle.
In lack of more information about what to achieve, see the syntax of
Insert with Select and Subquery
Update Statements
Not sure what your question is, but you can use the WITH clause to create "views" within a query - no need to create a VIEW and in 11g you can use recursive sub-query using the WITH clause.

Resources