How do I get the column name as the 1st row of the result set.I tried below but getting the error as shown below Answer I would recommend two changes to your query. Change UNION to UNION ALL. This way your union will not look for duplicates between the two parts of the union. Since the first part of your
Tag: oracle11g
Oracle Query With (BETWEEN Two Dates) Returns Empty Result Set
I have an Oracle SQL Query I am trying to run, but it keeps returning null value for the second query below but when I use the first query it returns a value. Please can someone help me check what I may be doing wrong in query 2? Note that the date column is in the Format 21/09/2020 10:00:00 AM
SELECT Data with logic created date not greater than
I have three tables with detail structure and data like this : Table TBL_REFERRAL ID CREATED_DATE USER_NAME REFERRAL_CODE ——————————————————— 1 …
Display data of a column as a row in Oracle
First of all, I would like to thank you so much for your time in advance. I have a table as shown below: I would like to display the data from the above table as shown below: If no data is present within the COL_DESC for a row then the data from the COL_NAME column needs to be displayed. I
Get the last login date for all users in Oracle 11g
We have Oracle 11g so the following query didn’t work. select USERNAME,LAST_LOGIN from dba_users Then I searched and people suggested multiple ways and i got confused. What is the correct way to get …
Group by expression with case statement in oracle?
I have a query with case statement in it. This query gives me error ORA-00979: not a GROUP BY expression When I remove my last case statement from select then it runs fine. Please help me in this Answer Columns that aren’t aggregated should be part of the GROUP BY clause. It means that “solution” isn’t to remove the 2nd
Insert data using two select queries with different count of rows
I Wish to enter data into a third table while getting the data from the first two tables.In this case the first table is profile and second table is menu, and the third table is profile_menu. My objective is to map menus to a specific profiles.Practically one profile can have mapping to multiple menus. I am using the below query
SQL – Select rows partially depending on another table
I am very new to the database and queries. I am not sure if this is very basic. Please help me to find a solution. I have two tables – subscription and customer with primary keys as subscription_id and customer_id respectively. the customer_id is foreign key pointing to customer table customer_id column. Below is a sample of table and its
Sum REGEXP_SUBSTR resulting ORA-01722: invalid number error
I’m creating a reconciliation report where I basically just want to know document value of each sent batch. Batch ID is in its own column and sent data is in one column and it’s comma separated, see randomly generated example below: Each batch have minimum 2 rows and max can be 2000 rows. In this table I have two columns:
Passing date to Stored Procedure in Oracle SQL error : ORA-01858
I know this question has been answered previously, and I have tried out the solution given in them without success. I have a stored procedure as below(I have removed non-essential parts) : CREATE OR …