date interval from sybase to oracle - oracle

hi guys a need your help, I'm migrating some stored procedures from sybase to oracle, and I don't know how to transform this line to oracle.
select #date_vig_aux = dateadd(ss,-1,#date_vig_aux)
I would appreciate if you help me.

Supposing date_vig_aux is defined as DATE or TIMESTAMP in pl/sql, this should translate into
date_vig_aux:=date_vig_aux+numtodsinterval(-1,'second');

Related

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.

String Aggregation that works in both oracle and postgresql

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

Oracle to redshift query migration

I am trying to transition from Oracle to redshift and got stuck with this function conversion. Can someone help me with this?
Oracle: trunc(to_date('{RUN_DATE_YYYYMMDD}', 'YYYYMMDD')-6, 'DAY')
RedShift: ?
You are actually getting the date without the time part.
In Redshift, you can simply use
'{RUN_DATE_YYYYMMDD}' :: date - 6
or
to_date('{RUN_DATE_YYYYMMDD}', 'YYYYMMDD')-6

Update statement works in Oracle 9i but not in Oracle 11G

I'm facing an issue with an update statement that worked earlier in Oracle 9i but now it does not update any rows in Oracle 11G. Here is the statement that i'm using.
update account
set
days_to_validate = validated_date - val_requested_Date
where
validated_date >= val_requested_date
The validated_date and val_requested_date are both date fields in the format: dd-mmm-yyyy (18-Mar-2015). This was working earlier in Oracle 9i before we did an upgrade.
Pls advice on how we can fix this.
Thanks
Prashanth
I was able to fix this. I tried including the "to_date" function and it worked in Oracle 11G. Here is the change i made to the query.
update account
set days_to_validate = to_date(validated_date) - to_date(val_requested_Date)
where to_Date(validated_date) >= to_date(val_requested_date)

Data Types in oracle-Not sure to decide on which to use

For Sybase,I use the following datatypes.
Can anyone suggest me the oracle equivalent for the same
int8,int16,int32, char name[233],char name1,char name[256],ScaledDecimal64_t
Please let me know the oracle equivalent for the above datatype which has been defined in the C(generated code for sybase)
Would the Sybase to Oracle datatype mappiong grid on this page help?
http://www.indiana.edu/~dss/Services/DataWarehouse/Oracle/Sybase/conversion.html

Resources