Skip to content

Tag: oracle

Using ORDER BY to pair values in SQL ORACLE

I need to use ORDER BY in a query that uses UNION. The query returns the following: CRN Inv_1 Inv_2 GBP -100 -100 GBP -400 -400 GBP -500 -500 GBP -700 -700 GBP -800 -800 GBP -10000 -10000 GBP 100 100 GBP 400 400 GBP 500 500 GBP 700 700 GBP 800 800 GBP 10000 10000 Expected Output: CRN Inv_1

Is there any way to use CASE in WHERE clause in Oracle?

I have the following data in DB which supposed to be a date but in number format: date_col: 20200130.95656 20200910.85213 0 20220101.55412 0 0 20220730.85626 Now I need to format the dates to mm/dd/yyyy so I used the following command in oracle: to output it like this 07/30/22. But the problem I still need to…

How to write an array literal in SQL?

Is it possible to use an array literal in Oracle, such as: Or: Or what’s the simplest (i.e., possible not in PL/SQL?) way to do this? Answer if you wanta flexible list, y an use a type like this ID | INTLIST -: | :—— ID | COLUMN_VALUE -: | ———–: 1 | 1 1 | 2 1 | 3

Oracle missing FROM clause

Is it possible to create a CTE without a FROM, and if not isn’t that the whole point of a CTE in the first place? It seems a quick-fix for this is just adding FROM DUAL whenever needed. Is that what’s supposed to be done? Answer Yes, that’s exactly what dual is supposed to be used for. Selec…

Left outer join not showing unmatched pairs Oracle SQL

I have a table like this, let’s call it main location item price l1 item1 3.00 l1 item2 1.00 l2 item1 3.00 l2 item2 1.50 l2 item3 2.00 l3 item4 5.00 l3 item5 5.00 and a separate table, call it items items item 1 item 2 item 3 item 5 item 4 item 5 item 6 and am currently trying

SQL query to get / delimited column value in single row

I have this output: Table 1 Requisition_number per_id per_name Job_title Interview TAS_EMAIL_ADDRESS TAS_FNAME 22021 1097 Chad Manager This is a comment abc.g@gmail.COM abc 22021 1097 Chad Manager This is a comment xyz.g@gmail.COM xyz I want the output to look like this: Requisition_number per_id per_name Job…

ORACLE CONVERT CHAR FORMAT “YYYY-WW” TO DATE FORMAT

I am trying to convert char date format “YYYY-WW” in ORACLE to date for calculating by week in year but have a trouble with error message format code cannot appear in date input format If i write It will be normal But if i write The message error format code cannot appear in date input format appe…