I have 2 tables- ‘users’ and ‘department’. ‘Users’ table contains usernames along with the department they have access to. ‘Department’ table contains all department specific fields like manager, employees etc. Desired Output : I need each username along with the department ...
databaseanswers.net Latest Questions
Now I want to find min value through that cursor c3 and update the Sid = min value we get from that cursor create or replace procedure assign_ticket(cticketid int) is varticketid int; varticketstatus int; varmincount int; varsid int; mcount int; cursor c1 is select tkid from ticket where ...
I have a PL/SQL procedure that consumes two input parameters of type VARCHAR2 (amount is nullable, exact_amount is just a true/false flag but Oracle does not support boolean types): amount in ...
For a more complicated situation I’m trying to OPEN FOR for text that includes a nested OPEN FOR, and I’m completely stumped: Was hoping this would work: DECLARE cur SYS_REFCURSOR; cur2 SYS_REFCURSOR; inner_text varchar2(1024) := 'select * from ...
I tried this code and it didn’t work, how can I return specific column with the Id from the function? create or replace function getData(column_name varchar2,emp_id number) return varchar2 is name varchar2(100); sql_stmt VARCHAR2(100); begin sql_stmt :='SELECT ...
I searched quite a long time in internet but could not find releated answers for it . Hope its not a duplicate one. In PostgreSQL i want to join a column having a list of Foreign Keys . I need ...
I’m trying to understand why OPEN CURSOR FOR will allow SELECT but not UPDATE/INSERT For example: create table users( name varchar2(100) ); declare cur sys_refcursor; begin open cur for 'insert into users values (''Sean'')'; dbms_sql.return_result( cur ); end; Returns target of OPEN must be ...
update customers set transaction_id = ( select transaction_id from transactions where transaction_type IN (select transaction_type from customers where id = 1) ); gives the error 1093. You can’t specify target table for update in where ...
My problem is that I can’t optimize my sql-query so that it works faster. In fact I haven’t waited up for its executing once ’cause it’s really slow and there is much data. All filters are necessary. The idea How it was: ...
When trying to load data from staging table to the Interface Table I’m getting this error "error validating template_name: ORA-01422: exact fetch returns more than requested number of rows". I also gave a correct Template name, even then getting the ...