My scenario is to insert values into 'out' column by comparing 's' and 'IP' columns of temp table.The exact situation is at first need to go to ip column,take a value and then go to source column and check for the same value of ip which is taken previously.Then after corresponding ip of that source column should be inserted back in previous source column.
The situation is marked clearly in file which i am attaching with '--' comments at respective places.I am also pasting the code which i tried out,unfortunately it is giving error as exact fetch returns more than requested number of rows since there are duplicates in the table.I tried it using nested for loops.Also implemented using rowid,but it didnt work.
fixing the errors or if there is any new logic that can be implemented.
DECLARE i_e NUMBER(10); BEGIN FOR cur_1 IN(SELECT IP from temp where IP IS NOT NULL) LOOP FOR cur_2 IN(SELECT IP from temp where s=cur_1.IP)
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
On my APEX page i have region which has sql query as source and it displays as HTML table the query result to the user.
I want to display addinonal column with a hyperlink inside, and that hyperlink would have CGI/URL-parameters which contains the other values of the HTML row.
So, let's say my APEX region queryes columns as "select c1, c2, c3, c4 ..." and displays out values "V1, V2, V3, V4" then i want to have addional output column with such hyperlink:
a href="f?p=100:7:13467554876288::NO::c1,c2,c3,c4:v1,v2,v3,v4">My link column with CGI-parameters</aHow can i create such hyperlink?
The overall idea is that the link would forward to a page which loads those values "v1,v2,v3,v4" into form fields and user can proceed from there.
I want to pass multiple column values of a row in an interactive report page to hidden items in another page through column link. And I did it successfully. However, I found I need to pass more than 3 columns of a row in this report, while a column link only permits me to pass 3 column value at most. Is there anyway that I can pass more column values to hidden items in another page?
AID UCD U_TXT UDATE PID 116 1 Req Documents 01-OCT-2011 100 116 2 AGG APPR 01-OCT-2011 101 116 3 Docs received 02-oct-2011 102 116 1 Tmp received 02-oct-2011 103 117 2 Notice sent 03-oct-2011 104
UCD - We have total 19 codes (1 to 19), each can have multiple rows for one AID.. like 1 repeated twice for AID 116. PID - Primary id (Primary key column)
Output I am looking -------------------- AID COL1 COL1_TXT COL1_DATE COL2 COL2_TXT COL2_DATE..ETC 116 1 'Tmp received' 02-oct-2011 2 AGG APPR 01-OCT-2011 117 2 Notice sent 03-oct-2011
If the same UCD repeated multiple times then we should get the max(PID) record for that UCD and for that AID
I tried with group by AID,PID. but couldn't bring the rows to columns. I have attached the script with the post
i'm trying to put more than one value in one column (by putting value '26','63' in column), so i have next problem:
1. Query select cr_pjid from acc_users where username='ACCBTPS121' give result CR_PJID --------- '26','63'
2. Query select * from acc_accbtp_nova_view where ed_id=2 and to_char(pj_id) in ('26','63'); return 186 rows.
3. Query: select * from acc_accbtp_nova_view where ed_id=2 and to_char(pj_id) in (select cr_pjid from acc_users where username='ACCBTPS121'); doesn't return any row...
Most of the code is working properly except when it come to a person with more than one email type in the table:
Below is the
select emal_pidm, emal_email_address, emal_emal_code, case when emal_emal_code = 'PER' and lag(emal_emal_code,1,'?') over (partition by emal_pidm order by emal_email_code) = 'EMPL' then emal_email_address [code]......
Below is Sample data for testing
INSERT INTO emal (emal_pidm, emal_email_address, emal_emal_code) VALUES (1024069, 'emmaus.ferdinand@xxxx.edu','EMPL'); INSERT INTO emal (emal_pidm, emal_email_address, emal_emal_code) VALUES (1024069, 'emfer1@xxxx.edu','PER'); [code].......
The attachment is what the output should look like.
Here is my requirement..... I am pretty new to PL/SQL.
This is the procedure
CREATE OR REPLACE PROCEDURE ABCPROC.SP_ABC ( XML IN CLOB, P_refcursor OUT SYS_REFCURSOR ) AS BEGIN [code]........
For each account number (I_AC), we have multiple rows in ABC_SVC table. I want to return these values in the refcursor. The issue with above SQL program, the row is returning only when the account(I_AC) have values for all the products 100,101,102. If the row does not exist for one account, then the account row is returned with other products.
I want my output should be in the below format
ACCOUNT_NUMBER COMMISSION CONSUL CONTRA 1YYN 2NN 3N
My task is I want to retrieve all the Insert Statements of the rows that are present in each table of a particular Schema.
When I give input as Schema name(Scott) in a Procedure, Then the procedure retrieves all the Insert statements of rows of all tables that are present in scott user.
For this I started like this..
CREATE OR REPLACE PROCEDURE MYPROC(UID DBA_OBJECTS.OWNER%TYPE) AS CURSOR MYtab IS select o.owner, o.object_name from dba_objects o where O.OWNER=UID
[code]....
When I execute this procedure I got the result as follows.
EXEC MYPROC('SCOTT'); insert into DEPT(DEPTNO,DNAME,LOC) values ( insert into EMP(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ( insert into BONUS(ENAME,JOB,SAL,COMM) values ( insert into SALGRADE(GRADE,LOSAL,HISAL) values ( insert into PROJECT(PNO,PNAME,PMGR,PSTART,PEND,BUDGET) values (
[code]....
As you see that I have executed successfully till each table columns.But How to retrieve the values in this?
I am trying to get only those values which are not present in the column. I have tried but i think that i am wrong in logic.
SELECT dummy FROM DUAL WHERE dummy IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13') AND NOT EXISTS ( SELECT pay_list_serial FROM per_requests_master WHERE request_status IN ('4', '5') AND pay_list_no = :list_no)
I have two string one is comma separated values as a column name and another string which is having the comma separated value corresponding to the column name.
I have a requirement in which the amount need to be split in to multiple period.
For example if there amount of 3000 and start and end date is 01-jan-2013 and 31-mar-2013 then the output of the query should be
Name Start Period End Period Jan-13 Feb-13 Mar-13 ------------------------------------------------------------------------------ XXX 01-JAN-13 31-MAR-13 1000 1000 1000
insert all into concat_test (empno,empname,description) values ('1','pratik','want') into concat_test (empno,empname,description) values ('1','pratik','to') into concat_test (empno,empname,description) values ('1','pratik','concat') select * from dual;
I need to extract the values and store it in seperate column. write the function to extract the data from column.I am having column DOC_NO from which i have to extract dob, gender, nationality Doc_no:
9005070288080 DOB : 900507- yyddmm Gender : 0288- if less than 5000 then female else male Nationality: 080- 0 means India 1 means foreigner.
create table teststr (indname varchar2(20), counter1 number,counter2 number,counter3 number,counter4 number); insert into teststr values('a',10,20,30,30); insert into teststr values('b',10,20,5,3); insert into teststr values('c',2,4,5,2); insert into teststr values('d',1,2,3,4); insert into teststr values('e',4,5,4,4);
Now i need the output if any of the column values are same.
output should be
select indname from teststr where counter1=counter2 or counter1=counter3 or counter1=counter4 or counter2=counter3 or counter2=counter4 or counter3=counter4
a c e
Is ther any other way to write the query instead of the numerous or conditions if i want to compare the column values in a table.
I'm using the Oracle Emp,Dept tables as my sample. I want to display certain table column values based on some criteria. If met, display those values otherwise display other column values
For example:
So when dept.deptno=10, I want to display these 2 columns values 1. dept.deptno 2. dept.dname
otherwise, display these 2 columns values 1. dept.loc 2. null
Can this be done with one case, decode or "other" type of structure going thru the table one time??
SELECT emp.empno, emp.ename, CASE WHEN dept.deptno = 10 THEN to_char(dept.deptno) [code].......
I have an requirement like below and would like to have SQL for that.
Source Table:
EMP_NO EMP_CODE 1 'A' 1 'D' 1 'E' 1 'F'
2 'S' 2 'A' 2 'W' 2 'Q'
3 'A' 3 'T' 3 'D' 3 'E'
4 'D' 4 'A'
I want to load only data which has EMP_CODE as A and doesn't have subsequent 'E' or 'F' in it. In the above source you can see EMP_NO 2 and 4 satisfy the condition and rest wont. So i want the output data like below.
I have a data in one table with 6 columns where user may be updating values in all of these 6 columns or he may enter 3 or 4 columns based on that inserts should take place, this is similar to my previous thread , i am using if condition to check column for null if its not null then i will make a insert , but is there any other easier way to do this.
insert into ot_po values ('ss-po',1,ph_sys.nextval); insert into ot_inspect_head values (inh_sys.nextval,'ss-ins',1,'ss-po',1); commit; select * from ot_inspect_item
--Now if the inspection user issues the update statement , it will delete this row --from ot_inspect_item and reinserts the values with values based on --ii_flex_01,ii_flex_02,ii_flex_03 [code]...