I am trying to use v(‘APP_USER’) as default value for a column. I get null when I use it in select like But when I use it as default in column, like below, I am getting error. Error Can anyone explain this or have a turnaround for this ?? Answer There are other options than V(‘APP_USER’…
Tag: oracle
oracle SQL Concatenate 2 columns based on condition
let’s say i have a table : +—-+————+————+ | ID | NAME1 | NAME2 | +—-+————+————+ | A1 | DAVE | DAN | | A1 | DOR | MON | | A2 | …
Recursive query in Oracle until a parent in the hierarchy meets a condition?
I have a table like the following: And I’d like to be able to fetch each ID with its corresponding VALUE_ID. I want to do it in such a way that if a row has a VALUE_ID as NULL, it “inherits” the VALUE_ID of the first parent above it in the hierarchy, that has a VALUE_ID as NOT NULL. So
Select list as column in Oracle SQL
I would like to append a few rows to an already existing table (15 rows to be precise). What is the quickest way to do this? This works, but it seems redundant. I was wondering if there’s a solution along the lines of: Please note that I want to preserve the leading zeros for each element in my list. Th…
I need to write a query to return user_type based on all types that user was associated to in a single row
I have table with a user column and user_type column. A user can be associated to multiple user_type’s. There are a total of five different user_type’s in the column. I have a requirement to find each …
Oracle select same id where 2 exist
so this query of this Oracle table shows 2 rows with same id all good — but there are other ids that have more than 1 entry as well so this query: works but brings back 2 different ids that both have more than 1 entry I don’t care which id I get. I just want both of the ids
How to use SQL find first matching result from one table in another table?
Suppose I had two tables: What I want to do is write a query that will find the first sale for each customer. I am not sure exactly how to do it. I feel like this is group by problem, but the answer is not coming to me. EDIT: I feel like my first data table did not fully explain
Best way to insert into multiple tables in a cluster
Suppose I have a wide table (CUSTOMERS) that contains lots of columns (CUSTOMER_ID, FIRST_NAME, LAST_NAME, DOB, ADDRESS, PHONE_NUMBER, etc). This table is used in several full table scans, each of which selects only a small number of the columns of the table. Since this table is very large, these full table s…
Passing Multiple Values To PL/SQL Input
I have an Oracle package which contains a function. This function has 3 inputs. I need to pass multiple values to each input. I could automate a process which runs it multiple times with each combination of variables but I would like to only make one call to the database. Simplified Code Answer Pass it with q…
Oracle 12c updating multiple rows with the same data
I’m trying to write a script that pulls out all of the distinct ‘words’ in a string and saves them in another field. I’ve gotten the process to work in Oracle 19c (though any advice is welcome) but when I run the script in 12c the first record is correct but all the following records h…