Skip to content
Advertisement

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 get the 0 values in

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. Selecting from the

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_title Interview TAS_EMAIL_ADDRESS TAS_FNAME 22021 1097 Chad Manager This is a comment abc.g@gmail.COM abc/xyz 22021 1097

Create a “flag” table that references unique IDs in 3 different tables

Oracle SQL I have account IDs in 3 different tables (one column per table). They sometimes repeat within the table’s column. Some of the distinct account IDs in Table 1 also appear in Table 2. Some appear in all 3 tables. There is no mutual exclusivity requirement across the tables (i.e – an account ID can appear in any combination

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 appear. I don’t have

Oracle Hierarchy – How to get a particular level record in a query?

We have the following structure for Organizations. Query returns the result What I’m trying to do is let’s say I need to get the Department (Information Technology Department) of org_id 4 (Database Unit), how should I build the query for that? Currently we built a function that returns the department id which basically loops until it reaches the DEP parent.

Advertisement