COMBINING COMMON COLUMNS IN SELECT QUERY
hi all,
While make inner join between two tables how to link more than one
common colums , which operator i want to use, shall anybody give me one ex.
Thanks in advance.
R.Vijai
hi
good
try like this
SELECT c~matnr "Material no.
c~werks "Plant
c~lvorm "Flag Mat.-Del. at Plant level
c~bwtty "Valuation category
c~kzkri "Indicator: Gritical part
c~dispr "Material: MRP profile
ADD Mike Krepcik TD 3363 02/01/05 D10K913640
c~dismm "MRP type
END TD 3363 02/01/05 D10K913640
c~plifz "Planned delivery time in days
c~perkz "Period indicator
c~minbe "Reorder point
c~mabst "Maximum stock level
c~umlmc "Stock in Tran. (plant to plant)
a~mtart "Material type
a~meins "Base unit of measure
k~spras "Language key
k~maktx "Material description
w~bwkey "Valuation area
w~bwtar "Valuation type
w~lbkum "Total value stock
w~salk3 "Value of total valuated stock
w~verpr "Moving ave. price/periodic unit
w~peinh "Price unit ADD D10K913194
FROM marc AS c LEFT OUTER JOIN mara AS a
ON cmatnr = amatnr
LEFT OUTER JOIN makt AS k
ON cmatnr = kmatnr
LEFT OUTER JOIN mbew AS w
ON cmatnr = wmatnr AND
cwerks = wbwkey
INTO TABLE i_splus
WHERE c~matnr IN s_matnr "Material no.
AND c~werks IN s_werks. "Plant
thanks
mrutyun^
Similar Messages
-
Function as column in select query
Recently I came upon a couple of applications using Oracle database 10g that use functions as a column in a select query for reporting purposes. These queries were taking about 10 minutes to return 55,000 records. How can such queries be optimized where the functions in the queries cannot be modified?
Can the performance be improved at all without a re-design of the query?
SELECT
col1
,col2
,fn_get_val(col3)
,col4
,col5
FROM
table a,
table b
WHERE .....; The above function "fn_get_val" is defined as:
CREATE OR REPLACE fn_get_val(i_col IN VARCHAR2) return varchar2
as
CURSOR c ( i_var VARCHAR2 )
business logic here again
begin
OPEN c( i_col );
LOOP
Loop through the above cursor
EXIT; -- exit when condition satisfied.
END LOOP;
CLOSE c;
end;
/Thanks in advance!user1980 wrote:
Can the performance be improved at all without a re-design of the query?Possibly if function is deterministic.
Simplistic example:
SQL> create or replace package Global as
2 counter integer := 0;
3 end;
4 /
Package created.
SQL>
SQL> --// non-deterministic
SQL> create or replace function EmpName( empID number ) return varchar2 is
2 cursor c is
3 select ename from emp where empno = empID;
4 empName varchar2(10);
5 begin
6 Global.counter := Global.counter + 1;
7 --// simulating your explicit cursor loop
8 open c;
9 fetch c into empName;
10 close c;
11
12 return(
13 InitCap(empName)
14 );
15 end;
16 /
Function created.
SQL>
SQL>
SQL> exec Global.counter := 0;
PL/SQL procedure successfully completed.
SQL> select
2 empName( 7369 ) as NAME
3 from dual
4 connect by level <= 100;
NAME
Smith
Smith
100 rows selected.
SQL> exec dbms_output.put_line( 'Counter='||Global.counter );
Counter=100
PL/SQL procedure successfully completed.
SQL>
SQL> --// deterministic
SQL> create or replace function EmpName( empID number ) return varchar2 deterministic is
2 cursor c is
3 select ename from emp where empno = empID;
4 empName varchar2(10);
5 begin
6 Global.counter := Global.counter + 1;
7 --// simulating your explicit cursor loop
8 open c;
9 fetch c into empName;
10 close c;
11
12 return(
13 InitCap(empName)
14 );
15 end;
16 /
Function created.
SQL>
SQL> exec Global.counter := 0;
PL/SQL procedure successfully completed.
SQL> select
2 empName( 7369 ) as NAME
3 from dual
4 connect by level <= 100;
NAME
Smith
Smith
100 rows selected.
SQL> exec dbms_output.put_line( 'Counter='||Global.counter );
Counter=1
PL/SQL procedure successfully completed.
SQL> So 1 execution of the function versus a 100 executions. But it is not always that straightforward and simplistic.
The ideal would be to not use a user function in the first place - but to instead apply that function's logic directly in SQL using native SQL statements. -
Facing problem with a date column in select query
Hi,
I am facing problem with a date column. Below is my query and its fainling with " invalid number format model" .
Query: SELECT *
FROM EMP
WHERE trunc(LAST_UPDATED) >= to_date(to_char(22-05-2009,'dd-mm-yyyy'),'dd-mm-yyyy')
LAST_UPDATED column is "DATE" data type.
Please help me ThanksRadhakrishna Sarma wrote:
SeánMacGC wrote:
WHERE LAST_UPDATED >= to_date('22-05-2009','dd-mm-yyyy');
You do not need the TRUNC here in any case.
I don't think so. What if the user wants only data for 22nd May and the table has records with date later than 22nd also? In that case your query willl not work. In order for the Index to work, I think the query can be written like this I think Sean is right though. Use of TRUNC Function is quiet useless based on the condition given here, since the to_date Function used by OP will always point to midnight of the specified date, in this case 22-05-2009 00:00:00.
Regards,
Jo
Edit: I think Sean proved his point... ;) -
Can i update more then one column using select query.
Dear All,
Can i update more then one column of target table A from source table B. Like
Update table A set A.A1 = (Select B.B1 from B where A.A3 = B.B3).
Above stmt. I am updating only one column. But I want to update more then one column A.A1 and A.A2
Plz give me the possible ways.
Thanks,
VikasYes you can do. Try the below Query
Update A set (A.A1,A.A2) = (Select B.B1,B.B2 from B where A.A3 = B.B3) -
How to create a Type Object with Dynamic select query columns in a Function
Hi Every One,
I'm trying to figure out how to write a piplined function that executes a dynamic select query and construct a Type Object in order to assigned it to the pipe row.
I have tried by
SELECT a.DB_QUERY INTO actual_query FROM mytable a WHERE a.country_code = 'US';
c :=DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c,actual_query,DBMS_SQL.NATIVE);
l_status := DBMS_SQL.EXECUTE(c);
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
FOR j in 1..col_cnt LOOP
DBMS_SQL.DEFINE_COLUMN(c,j,v_val,2000);
END LOOP;
FOR j in 1..col_cnt LOOP
DBMS_SQL.COLUMN_VALUE(c,j,v_val);
END LOOP;
But got stuck, how to iterate the values and assign to a Type Object from the cursor. Can any one guide me how to do the process.
Thanks,
mallikj2Hi Justin,
First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
Thanks in Advance,
mallikj2. -
Select query with combination of two columns
I need looking to write a nested select statement that would achieve the following.
Support i have a table as follows
TestTable
Name : Age : Country
Test1 : 10 : USA
Test2 : 11 : USA
Test3 : 12 : USA
Test4 : 11 : Canada
Test5 : 12 : Canada
Now i want to select from the above table the following information.
Get all the names of people who dont belong to this combinations (10:USA,11:Canada,12:Canada). The list can be huge.
The result should be
Test1:10:USA
Test1:12:USA
If it were one combination i can write
select * from TestTable
where age <> 10 and country <>Canada
Also i can also do
select * from TestTable
where age NOT IN (10,11) and country NOT IN (USA,COUNTRY)
But i don't this it would give me correct result.sush_msn wrote:
Is there a way i can pass the age and country as list to the query ?You asked the right question.
Three things you need to know:
1) Your test data doesn't cover all combinations. Here is more complete test data:create table test_table1 as
WITH AGES AS (
SELECT LEVEL+10 AGE FROM DUAL CONNECT BY LEVEL <= 3
), COUNTRIES AS (
SELECT 'USA' COUNTRY FROM DUAL
UNION ALL
SELECT 'CANADA' COUNTRY FROM DUAL
SELECT 'Test' || ROWNUM NAME, AGE, COUNTRY FROM AGES, COUNTRIES;
NAME AGE COUNTRY
Test1 11 USA
Test2 11 CANADA
Test3 12 USA
Test4 12 CANADA
Test5 13 USA
Test6 13 CANADA2) Now here is the answer to your question. You can put two or more values together in an expression by putting parentheses around them.SELECT * FROM TEST_TABLE1
WHERE (AGE, COUNTRY) NOT IN (
(11, 'USA'),
(12, 'CANADA')
NAME AGE COUNTRY
Test2 11 CANADA
Test3 12 USA
Test5 13 USA
Test6 13 CANADAThis is what Etbin did above, but he used a SELECT instead of a list of values.
3) Can AGE or COUNTRY ever be NULL? Do you want to return the records that have NULL values in them? If so, you need to use NOT EXISTS instead of NOT IN. Warning: Etbin's code needs a little change: "where (age,country) = (t.age,t.country)" should be "where (age,country) = ((t.age,t.country))". You always need extra parentheses on the right side. -
Selecting duplicate rows based on a combination of columns as key
Hi ,
I have a table with 5 columns.
Code ID S_DATE E_DATE Name
1 23 01012001 null ABC
1 09 01012001 null XYZ
2 81 04022007 null TVU
1 43 03092008 null XXX
Now, I need write a select query to fetch the duplicate rows from the above table having the combination of (Code, S_DATE,E_DATE) as the key.
So from the above example, I need to get Row1 and Row2 as output (but not Row3 as it has a different S_DATE)
Thanks in advance for your suggestions.
Thanks
Edited by: thotaramesh on Mar 9, 2009 4:54 PMOn XE;
WITH sample_data AS (
SELECT 1 code,23 ID, '01012001' s_date, null e_date, 'ABC' NAME FROM dual UNION ALL
SELECT 1, 09, '01012001', null, 'XYZ' FROM dual UNION ALL
SELECT 2, 81, '04022007', null, 'TVU' FROM dual UNION ALL
SELECT 1, 43, '03092008', null, 'XXX' FROM dual)
SELECT code, ID, s_date, e_date, NAME
FROM (
SELECT
sample_data.*,
COUNT(*) over (PARTITION BY code, s_date, e_date) dups
FROM sample_data)
WHERE dups > 1;
CODE ID S_DATE E_DATE NAME
1 23 01012001 ABC
1 9 01012001 XYZ -
Convert columns to rows by a select query
I have a table with 10 columns. Pk is combination of 3 columns, let us say A, B and C. I need a select query which returns 7 rows with four columns each let us say A,B,C and D where D contains the value of non PK column. i.e. for first row, D will contain value of fourth column of the table, for second row, D will contain fifth column of the table and so on.
Please help.Maybe NOT TESTED!
select col_a,col_b,col_c,column_4 col_d
from (select col_a,col_b,col_c,col_d,col_e,col_f,col_g,col_h,col_i,col_j
from the_table
unpivot include nulls (column_4 for source_column in (col_d as 'col_d',
col_e as 'col_e',
col_f as 'col_f',
col_g as 'col_g',
col_h as 'col_h',
col_i as 'col_i',
col_j as 'col_j'
)Regards
Etbin -
Supress the ROW_ID column in the Select Query.
Hi,
I have one custom form and from main form I am calling the Line Form.
But when I am clicking the LINE button then Form is getting open but it is giving one Error message like
FRM-40505: Oracle Error:unable to perform query
Once I check the Detail error.
it is giving me this message.
ORA-00904: "ROW_ID": invalid identifier
And I checked the query my query is returning the ROW_ID column.
Please help on Suppressing the Row_id column getting selected from the query.
Thanks
NiharHi Nihar;
Please see:
Transactions Workbench Error: Listing of FRM Errors [ID 1321612.1]
Regard
Helios -
Cursor in select query in row to column format
Hi
I have the query like below
SELECT d.department_id,
CURSOR(SELECT e.first_name,
e.last_name
FROM employees e
WHERE e.department_id = d.department_id
) emps
FROM depatments dI want the result set in a format of Row To columns like
10 20
<cursor result> <cursor result>pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with thisvishnu prakash wrote:
Hi
I have the query like below
SELECT d.department_id,
CURSOR(SELECT e.first_name,
e.last_name
FROM employees e
WHERE e.department_id = d.department_id
) emps
FROM depatments dI want the result set in a format of Row To columns like
10 20
<cursor result> <cursor result>pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with thisNumber of column of a select query is static. Must be known at the parsing time itself. But in your case i dont think the number of columns will be limited to 2 (10 and 20) there could be many more.
You can search this forum to see how to PIVOT your data. There are lot of example. You can also try dynamic pivot. Its all in here, just search. -
Column order in a select * query
Suppose I have 256 columns in a table and if I query select * from tablename ,what will the column order in the result.Will this be always same as order as in created statement?
If the columns were all in the original CREATE TABLE statement, then, yes, the ordering of columns in SELECT * FROM will match the order from the CREATE TABLE statement.
If columns were added after the initial create, then the original columns will come first (in their order) and then the added columns (in their order), etc.
In the real world, it is a very bad practice to use SELECT * and have expectations about the ordering of the columns. Consider this scenario:
Table T was created and implemented in production a year ago with columns A, B, C
A project started up three months ago and added column D but the project is stalled in development. So in development T had columns A, B, C, D
Later, another project started up and added columns E and F. Unlike the other project, it has progressed to Test. and Production. So in Development the table has columns A, B, C, D, E, F. In test and production the table has columns A, B, C, E, F.
Now that stuck project has progressed to Test and Production. Now T has columns A, B, C, E, F, D in test and production but still A, B, C, D, E, F in development.
Until someone notices and decides to fix it (where and how?)
Be very, very careful about using SELECT *. -
Unknown Column Name "XYZ" not detemined untill runtime.Select query.
Hi,
I have written a query in ABAP.I am getting following error.Can some one help me resolve this.There is a column "LANDX" in standard table T005 of PI which i need to get values from. The problem is that the column is visible only at runtime and not otherwise.How can i fetch data from this coulmn writing a select query for this.
Query written is:
SELECT landx from T005 into table it_t005.
Error:
"Unknown column name "XYZ" not determined untill runtime,you cannot specify a field list."Hi Deepika u were right. that there is a landx field but it is included in that table.
so u cant exactly get it.
now u can get ur country name and iso code just like this.
tables: t005t , t005.
data: BEGIN OF it OCCURS 100,
landx like t005t-landx,
intca like t005-intca,
END OF it.
SELECT t005t~landx t005~intca into CORRESPONDING FIELDS OF TABLE it
from T005t
INNER JOIN t005 on ( t005t~land1 = t005~land1 ).
it is fulfilling ur need.
Edited by: Matt on Feb 3, 2009 7:49 AM - Please don't use txtspk -
Hi All,
The Actual query to perform is below.
SELECT name,number from emp WHERE CASE WHEN :1='T' AND term_date IS Not NULL THEN 1 WHEN :1='A' AND term_date IS NULL THEN 1 WHEN :1='ALL' THEN 1 ELSE 1 END = 1;
I have tried in DB adapter like below as a parameter for :1 as #vInputParam
SELECT name,number from emp WHERE CASE WHEN #vInputParam='T' AND term_date IS Not NULL THEN 1 WHEN #vInputParam='A' AND term_date IS NULL THEN 1 WHEN #vInputParam='ALL' THEN 1 ELSE 1 END = 1;
Getting Error code :17003 .java.sql.SQLException: Invalid column index error.
Please suggest me on using ':' bind character in DB adapter Select Query SOA11g.
Can someone help me on this please?
Thanks,
HariHi,
Could you please make sure your binding style(Oracle Positional,Oracle named..etc) of the Seeded VO and Custom Vo are same.
This is the option you will get when you are extending your vo. So make sure that both are same.
You can refer the below link too
VO extension leads to "Invalid column index" exception
Thanks
Bharat -
Select Query...... Combinations
Hi Experts,
I have a Custom table for finding approver which looks like the below data. If no data is entered in the highlighted fields it means " * " which is applicable for all.
Appl Type
Appl Subtype
Pers Area
Pers SubArea
Emp Grp
Emp Subgrp
End Date
Appr Level
Begin Date
Approver
CLAIM
1111
31.12.9999
3
01.01.2010
XXX
CLAIM
1111
PA
31.12.9999
3
01.01.2010
YYY
I am trying to write Select Query on this table as below.
DATA: t_appl_subty TYPE RANGE OF zzp_appl_sub,
w_appl_subty-sign = |I|.
w_appl_subty-option = |EQ|.
w_appl_subty-low = i_appl_subty.
APPEND w_appl_subty TO t_appl_subty.
CLEAR w_appl_subty.
w_appl_subty-sign = |I|.
w_appl_subty-option = |EQ|.
w_appl_subty-low = ''.
APPEND w_appl_subty TO t_appl_subty.
CLEAR w_appl_subty.
w_persa-sign = |I|.
w_persa-option = |EQ|.
w_persa-low = i_persa.
APPEND w_persa TO t_persa.
CLEAR w_persa.
w_persa-sign = |I|.
w_persa-option = |EQ|.
w_persa-low = ''.
APPEND w_persa TO t_persa.
CLEAR w_persa.
w_btrtl-sign = |I|.
w_btrtl-option = |EQ|.
w_btrtl-low = i_btrtl.
APPEND w_btrtl TO t_btrtl.
CLEAR w_btrtl.
w_btrtl-sign = |I|.
w_btrtl-option = |EQ|.
w_btrtl-low = ''.
APPEND w_btrtl TO t_btrtl.
CLEAR w_btrtl.
w_persg-sign = |I|.
w_persg-option = |EQ|.
w_persg-low = i_persg.
APPEND w_persg TO t_persg.
CLEAR w_persg.
w_persg-sign = |I|.
w_persg-option = |EQ|.
w_persg-low = ''.
APPEND w_persg TO t_persg.
CLEAR w_persg.
w_persk-sign = |I|.
w_persk-option = |EQ|.
w_persk-low = i_persk.
APPEND w_persk TO t_persk.
CLEAR w_persk.
w_persk-sign = |I|.
w_persk-option = |EQ|.
w_persk-low = ''.
APPEND w_persk TO t_persk.
CLEAR w_persk.
SELECT SINGLE * FROM zapprover
INTO wa_approver
WHERE appl_typ = i_appl_typ
AND appl_subty IN t_appl_subty
AND persa IN t_persa
AND btrtl IN t_btrtl
AND persg IN t_persg
AND persk IN t_persk
AND appr_lvl = i_appr_lvl
AND endda GE sy-datum.
I am passing data as
i_appl_typ = 'CLAIM'
i_appl_subty = '1111'
i_persa = 'PA'
i_btrtl = ' '
i_persg = ' '
i_persk = ' '
i_appr_lvl = 3
It is picking the First record, but as per my requirement if no data available with data “PA” then it has to fetch first record. I am not sure,It seems to be leading to combinations.
How can I write Select Query?
Please help me.Hi Jozef,
Initially i tried like this,
GET RUN TIME FIELD DATA(t1).
DATA: it_approver TYPE STANDARD TABLE OF zapprover,
lv_subrc TYPE sy-subrc.
DATA: lv_appl_typ TYPE zzp_appl_typ,
lv_appl_subty TYPE zzp_appl_sub,
lv_persa TYPE persa,
lv_btrtl TYPE btrtl,
lv_persg TYPE persg,
lv_persk TYPE persk,
lv_appr_lvl TYPE zzp_appr_lvl.
REFRESH it_approver[].
CLEAR: wa_approver,lv_appl_typ,lv_appl_subty,lv_persa,lv_btrtl,lv_persg,lv_persk,lv_appr_lvl,lv_subrc.
PERFORM fill_local_values USING i_appl_typ
i_appl_subty
i_persa
i_btrtl
i_persg
i_persk
i_appr_lvl
CHANGING lv_appl_typ
lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl.
SELECT * FROM zapprover
INTO TABLE it_approver
WHERE appl_typ = i_appl_typ
AND endda GT sy-datum.
IF 0 = sy-subrc.
SORT it_approver.
IF i_appl_typ = 'CLAIM'.
PERFORM read_appr TABLES it_approver
USING lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl
CHANGING lv_subrc
wa_approver.
IF NOT lv_subrc IS INITIAL AND wa_approver IS INITIAL.
DO 4 TIMES.
CLEAR lv_subrc.
PERFORM fill_local_values USING i_appl_typ
i_appl_subty
i_persa
i_btrtl
i_persg
i_persk
i_appr_lvl
CHANGING lv_appl_typ
lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl.
CASE sy-index.
WHEN 1.
CLEAR: lv_persk.
WHEN 2.
CLEAR: lv_persg.
WHEN 3.
CLEAR: lv_btrtl.
WHEN 4.
CLEAR: lv_persa.
WHEN OTHERS.
ENDCASE.
PERFORM read_appr TABLES it_approver
USING lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl
CHANGING lv_subrc
wa_approver.
IF lv_subrc IS INITIAL.
EXIT.
ENDIF.
ENDDO.
IF NOT lv_subrc IS INITIAL AND wa_approver IS INITIAL.
DO 6 TIMES.
CLEAR lv_subrc.
PERFORM fill_local_values USING i_appl_typ
i_appl_subty
i_persa
i_btrtl
i_persg
i_persk
i_appr_lvl
CHANGING lv_appl_typ
lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl.
CASE sy-index.
WHEN 1.
CLEAR: lv_persa,lv_btrtl.
WHEN 2.
CLEAR: lv_persa,lv_persg.
WHEN 3.
CLEAR: lv_persa,lv_persk.
WHEN 4.
CLEAR: lv_persg,lv_btrtl.
WHEN 5.
CLEAR: lv_persg,lv_persk.
WHEN 6.
CLEAR: lv_persk,lv_btrtl.
WHEN OTHERS.
ENDCASE.
PERFORM read_appr TABLES it_approver
USING lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl
CHANGING lv_subrc
wa_approver.
IF lv_subrc IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ELSE.
EXIT.
ENDIF.
IF NOT lv_subrc IS INITIAL AND wa_approver IS INITIAL.
DO 4 TIMES.
CLEAR lv_subrc.
PERFORM fill_local_values USING i_appl_typ
i_appl_subty
i_persa
i_btrtl
i_persg
i_persk
i_appr_lvl
CHANGING lv_appl_typ
lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl.
CASE sy-index.
WHEN 1.
CLEAR: lv_persa,lv_btrtl,lv_persg.
WHEN 2.
CLEAR: lv_persa,lv_persg,lv_persk.
WHEN 3.
CLEAR: lv_persa,lv_persk,lv_btrtl.
WHEN 4.
CLEAR: lv_btrtl,lv_persg,lv_persk.
WHEN OTHERS.
ENDCASE.
PERFORM read_appr TABLES it_approver
USING lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl
CHANGING lv_subrc
wa_approver.
IF lv_subrc IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ELSE.
EXIT.
ENDIF.
IF NOT lv_subrc IS INITIAL AND wa_approver IS INITIAL.
CLEAR: lv_persa,lv_btrtl,lv_persg,lv_persk.
PERFORM read_appr TABLES it_approver
USING lv_appl_subty
lv_persa
lv_btrtl
lv_persg
lv_persk
lv_appr_lvl
CHANGING lv_subrc
wa_approver.
ELSE.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ELSE.
" Error Handling
ENDIF.
GET RUN TIME FIELD DATA(t2).
DATA(t3) = t2 - t1.
FORM fill_local_values USING VALUE(p_0135) TYPE zzp_appl_typ
VALUE(p_0136) TYPE zzp_appl_sub
VALUE(p_0137) TYPE persa
VALUE(p_0138) TYPE btrtl
VALUE(p_0139) TYPE persg
VALUE(p_0140) TYPE persk
VALUE(p_0141) TYPE zzp_appr_lvl
CHANGING p_appl_typ TYPE zzp_appl_typ
p_appl_sub TYPE zzp_appl_sub
p_persa TYPE persa
p_btrtl TYPE btrtl
p_persg TYPE persg
p_persk TYPE persk
p_appr_lvl TYPE zzp_appr_lvl.
p_appl_typ = p_0135.
p_appl_sub = p_0136.
p_persa = p_0137.
p_btrtl = p_0138.
p_persg = p_0139.
p_persk = p_0140.
p_appr_lvl = p_0141.ENDFORM. " FILL_LOCAL_VALUES
FORM read_appr TABLES p_table STRUCTURE ztinp_approver
USING VALUE(p_0050) TYPE zzp_appl_sub
VALUE(p_0051) TYPE persa
VALUE(p_0052) TYPE btrtl
VALUE(p_0053) TYPE persg
VALUE(p_0054) TYPE persk
VALUE(p_0055) TYPE zzp_appr_lvl
CHANGING p_subrc TYPE sy-subrc
p_result TYPE ztinp_approver.
READ TABLE p_table INTO p_result
WITH KEY appl_subty = p_0050
persa = p_0051
btrtl = p_0052
persg = p_0053
persk = p_0054
appr_lvl = p_0055 BINARY SEARCH.
p_subrc = sy-subrc.
ENDFORM. " READ_APPR
I don't know whether this a best method or not, but working perfectly as i wanted. T3 is getting around 600 - 800ms. I don't how much time it could be for best execution. And i am feeling guilty to write this much code for single record. Please suggest me the simple and best way. -
Select query output as a separate column
Hi,
How to represent the different values in the same table column as an output in the separate columns using the select query ?
For example,
Table "A" has column "col1"
col1 contains values as below:
col1
====
1
2
3
4
5
now want to display the above column values as a separate column as the output.
col_alias1 col_alias2 col_alias3 col_alias4 col_alias5
1 2 3 4 5
How it can be done ?
Regards
Edited by: user640001 on Jan 31, 2011 11:19 PMHi,
You can try something mentioned in this link.
http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php
or try this
with t as (
select 'PID12' as product_id, 1 as status_id, 'Time1' as time from dual union all
select 'PID13', 2, 'Time2' as time from dual union all
select 'PID14', 3, 'Time3' as time from dual)
select min(case when status_id = 1 then product_id || ' ' || time end) as Recieved, min(case when status_id = 2 then product_id || ' ' || time end) as Accepted,
min(case when status_id = 3 then product_id || ' ' || time end) as Delivered from tcheers
VT
Edited by: VT on Feb 1, 2011 5:28 PM
Maybe you are looking for
-
Hi, I found out that wwv_flow_item.popupkey_from_query in combination 'SQL updateable report' does not work. It does not display the popup. It creates a extra column with the message below. In combination with 'SQL query' it works. Is it possible to
-
Activate extended classic scenario
Hello, when I try to activate extended classic scenario to create contracts in SRM and then transfer them to R/3 I have these options: Extended local PO BE Purch Grps Resp. Back-end check reqd Back-end errors, show as error msg Which options may I ha
-
my macbook pro isn't starting. it gets as far as the apple logo and loading wheel but does go any further, please help!!
-
Splitting (2 columns) footer
I have this text imported from word with footnotes and i want to use the CS5 split column function on the footers but it doesnt work. The footers are with in the rest of the text frame. Please help
-
Data convertion for VARBINARY of SQL 2000?
I have a VARBINARY data in my SQL 2000 database. I need to know what will be the conversion for VARBINARY. I used byte{}, unfortunately it gives SQL EXCEPTION: Unsupported data type. I also tried String, this time it does not give me SQL exception Un