Dynamic Sql Select Query : getting no response
Hi
I am working on a synchronous interface that has jdbc at the receiver side..
I need to be doing a select dynamically based on a filed from the request like
select locationId from dbTablename where empId = 'xxx' AND delFlag =0
the xxx will be populated from a filed in the request
For this i have set up a request structure with action as "SQL_QUERY" and the following query in the access field
SELECT location_id from dbtablename where empID='$cv_EMPID$' and delFlag=0
I have a key element which has a sub-element "cv_EMPID"
Unfortunately, the query doestn pull any records from the dbtable..
In sxmb_moni , I get a query like this
- <STATEMENT>
- <TABLENAME action="SQL_QUERY">
<TABLE>tablename</TABLE>
</TABLENAME>
<access>select cv_locationID from tablename where cv_empID='$cv_EmpID$'</access>
- <key>
<cv_EmpID>60000016</cv_EmpID>
</key>
</STATEMENT>
but there is no response
What do u think is the problem here?
Thanks
Krishna
Hi,
Refer these links:
http://help.sap.com/saphelp_nw70/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
RDBMS system integration using XI 3.0 JDBC Sender/Receiver adapter
SYNCHRONOUS SOAP TO JDBC - END TO END WALKTHROUGH
Check out this-
http://help.sap.com/saphelp_erp2005vp/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Also check that, JDBC driver is installed correctly- for this
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3867a582-0401-0010-6cbf-9644e49f1a10
Check out these links
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
JDBC Receiver Adapter -- Synchronous Select Step by Step
Regards,
Nithiyanandam
Similar Messages
-
Oracle SQL Select query takes long time than expected.
Hi,
I am facing a problem in SQL select query statement. There is a long time taken in select query from the Database.
The query is as follows.
select /*+rule */ f1.id,f1.fdn,p1.attr_name,p1.attr_value from fdnmappingtable f1,parametertable p1 where p1.id = f1.id and ((f1.object_type ='ne_sub_type.780' )) and ( (f1.id in(select id from fdnmappingtable where fdn like '0=#1#/14=#S0058-3#/17=#S0058-3#/18=#1#/780=#5#%')))order by f1.id asc
This query is taking more than 4 seconds to get the results in a system where the DB is running for more than 1 month.
The same query is taking very few milliseconds (50-100ms) in a system where the DB is freshly installed and the data in the tables are same in both the systems.
Kindly advice what is going wrong??
Regards,
PurushothamSQL> @/alcatel/omc1/data/query.sql
2 ;
9 rows selected.
Execution Plan
Plan hash value: 3745571015
| Id | Operation | Name |
| 0 | SELECT STATEMENT | |
| 1 | SORT ORDER BY | |
| 2 | NESTED LOOPS | |
| 3 | NESTED LOOPS | |
| 4 | TABLE ACCESS FULL | PARAMETERTABLE |
|* 5 | TABLE ACCESS BY INDEX ROWID| FDNMAPPINGTABLE |
|* 6 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
|* 7 | TABLE ACCESS BY INDEX ROWID | FDNMAPPINGTABLE |
|* 8 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
Predicate Information (identified by operation id):
5 - filter("F1"."OBJECT_TYPE"='ne_sub_type.780')
6 - access("P1"."ID"="F1"."ID")
7 - filter("FDN" LIKE '0=#1#/14=#S0058-3#/17=#S0058-3#/18=#1#/780=#5#
8 - access("F1"."ID"="ID")
Note
- rule based optimizer used (consider using cbo)
Statistics
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
0 bytes sent via SQL*Net to client
0 bytes received via SQL*Net from client
0 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
9 rows processed
SQL> -
hi friends,
i've a view called "risk_efforts" with fields user_id,user_name,wknd_dt,week_day,prod_efforts,unprod_efforts.
Name Type
ROW_ID NUMBER
USER_ID VARCHAR2(14)
USER_NAME VARCHAR2(50)
WKND_DT VARCHAR2(8)
WEEK_DAY VARCHAR2(250)
PROD_EFFORTS NUMBER
UNPROD_EFFORTS NUMBER
data is like this:
when there is some data in prod_efforts, unprod_efforts will be null
when there is some data in unprod_efforts, prod_efforts will be null
for example:
USER_ID USER_NAME WKND_DT WEEK_DAY PROD_EFFORTS UNPROD_EFFORTS
G666999 GTest 20100403 TUE null 3
G666999 GTest 20100403 TUE 14 null
now i want to combine these 2 rows into 1 row i.e o/p should be like this
USER_ID USER_NAME WKND_DT WEEK_DAY PROD_EFFORTS UNPROD_EFFORTS
G666999 GTest 20100403 TUE 14 3
i've tried all combinations but couldn't get the query. Please help me with the exact SQL select query.
thanks,
GirishWelcome to the forum.
First read this:
Urgency in online postings
Secondly, it's always helpful to provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
You have provided #3 and #4. However with no usable form of sample data forum members will often not respond as quickly as they could if you provided #2.
I'm just wagering a guess here but what about this:SELECT ROW_ID
, USER_ID
, WKND_DT
, WEEK_DAY
, MAX(PROD_EFFORTS) AS PROD_EFFORTS
, MAX(UNPROD_EFFORTS) AS UNPROD_EFFORTS
FROM RISK_EFFORTS
GROUP BY ROW_ID
, USER_ID
, WKND_DT
, WEEK_DAY -
Reg: SQL select Query in BPEL process flow
<p>
Hi,
I am suppose to execute a SQL select query (in BPEL Process flow) as mention below in JDeveloper using Database adapter.
</p>
<p>
SELECT LENGTH, WIDTH, HEIGHT, WEIGHT,
</p>
<p>
LENGTH*WIDTH* HEIGHT AS ITEM_CUBE
</p>
<p>
FROM CUBE
</p>
<p>
WHERE ITEM= <xyz>
</p>
<p>
AND OBJECT= (SELECT CASE_NAME FROM CUBE_SUPPLIER WHERE ITEM=<xyz> AND SUPP_IND = ‘Y')
<strong>Now my question is:
1.</strong> What does this "*" refer to in the query and how can I retrieve the value of LENGTH*WIDTH* HEIGHT from the query where LENGTH,WIDTH and HEIGHT are the individual field in the table.
2.What does this " AS" refer to? If " ITEM_CUBE " is the alies for the table name "ITEM" to retrieve the value, then query shoud be evaluated as
</p>
<p>
SELECT LENGTH, WIDTH, HEIGHT, WEIGHT,
</p>
<p>
LENGTH*WIDTH* HEIGHT AS ITEM_CUBE
</p>
<p>
FROM CUBE
</p>
<p>
WHERE <strong>ITEM_CUBE.ITEM</strong>= <xyz>
</p>
<p>
AND <strong>ITEM_CUBE.OBJECT</strong>= (SELECT CASE_NAME FROM CUBE_SUPPLIER WHERE ITEM=<xyz> AND SUPP_IND = ‘Y')
Is my assumption correct?
Please suggest asap.
Thanks...
</p>
<p>
</p>Hi
Thank for your reply!
I have a nested select query which performs on two different table as shown below:
<p>
SELECT LENGTH, WIDTH, HEIGHT, WEIGHT,
</p>
<p>
LENGTH*WIDTH* HEIGHT AS ITEM_CUBE
</p>
<p>
FROM CUBE
</p>
<p>
WHERE ITEM= <abc>
</p>
<p>
AND OBJECT= (SELECT NAME FROM SUPPLIER WHERE ITEM=<Item> AND SUPP_IND = ‘Y')
I am using DB adapter of Oracle JDeveloper in BPEL process flow, where I can able to select only one master table in DB adapter say SUPPLIER and its attributes at a time.But as per my requirment I need to select both the table (CUBE and SUPPLIER) in a single adapter to execute my query.
It can be achievable by using two DB adapter , One to execute the nested query and another to execute the main qyery considering value of nested query as a parameter.But I want to achieve it by using a single one.
Am I correct with my concept?
Please suggest how to get it ?
</p>
Edited by: user10259700 on Oct 23, 2008 12:17 AM -
How to capture all the rows returned from a sql select query in CPO
Hi,
I am executing an sql select query which returns multiple rows. I need to capture the values of each row to specific variables. How do I proceed.
Thanks,
SwatiThe select activities ("Select from Oracle," Select from SQL Server," etc.) against database already return tables. Use one of the database adapters to do your select, and it will already be in a table form. Just put your query in the select and identify the columns in your result table. The online help or the database adapter guides in the product documentation can help.
-
Dynamic PL/SQL block vs dynamic SQL SELECT
Hi there,
I have a question regarding the optimal way to code a dynamic SELECT INTO statement. Below are the 2 posiibilities I know of:
_1. Dynamically executing the SELECT statement and making use of the INTO clause of the EXECUTE IMMEDIATE statement_
CREATE OR REPLACE FUNCTION get_num_of_employees (p_loc VARCHAR2, p_job VARCHAR2)
RETURN NUMBER
IS
v_query_str VARCHAR2(1000);
v_num_of_employees NUMBER;
BEGIN
v_query_str := 'SELECT COUNT(*) FROM emp_'
|| p_loc
|| ' WHERE job = :bind_job';
EXECUTE IMMEDIATE v_query_str
INTO v_num_of_employees
USING p_job;
RETURN v_num_of_employees;
END;
_2. Encapsulating the SELECT INTO statement in a block and dynamically exectuting the block_
CREATE OR REPLACE FUNCTION get_num_of_employees (p_loc VARCHAR2, p_job VARCHAR2)
RETURN NUMBER
IS
v_query_str VARCHAR2(1000);
v_num_of_employees NUMBER;
BEGIN
v_query_str := 'begin
SELECT COUNT(*) INTO :into_bind FROM emp_'
|| p_loc
|| ' WHERE job = :bind_job;
end;';
EXECUTE IMMEDIATE v_query_str
USING out v_num_of_employees, p_job;
RETURN v_num_of_employees;
END;
I was just wondering which way would be preferred? I know the second method uses a bind variable for the INTO clause, but does the first one also use bind varialbes (no semi-colon)? Any differences in terms of efficiency or speed?
Thanks alot
Edited by: BYS2 on Oct 19, 2011 1:23 AMsybrand_b wrote:
No difference in terms of performance or speed
Both variants will wreck the primary purpose of PL/SQL: to avoid parsing.
When I would see a 'developer' do this, I would fire him on the spot.
Why abuse PL/SQL in such a fashion? Both statements don't require parsing, as there is nothing dynamic in them and indicate a complete lack of understanding of Oracle, or a desire to deliver completely unscalable applications, resulting in end-users desiring to lynch you, and rightly so.
Remove the dynamic SQL or find another job.
Sybrand Bakker
Senior Oracle DBANot dynamic? What if p_loc and p_job were generated dynamically based on user-input? or what if there were potentially thousands of tables that p_loc could refer to? Should I make a CASE statement with a thousand cases?
In addition, the first example was actually taken directly from the official Oracle Database Application Developer's Guide (version 10.2). http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_dynamic_sql.htm#i1006429 - look under 'Sample Single-Row Query Using Native Dynamic SQL' heading. Therefore, if you have any issues with this alleged 'improper' usage of dynamic SQL, perhaps you should go talk to Oracle directly.
While I appreciate your response, I don't think it has occurred that you that not everyone is a 'developer'. In fact, I have only very recently (several days ago) taught myself how to use Oracle SQL, PL/SQL and XMLDB by reading several of the official Oracle language and developer's guides. It is more a passing interest to me as I am working on some medical research which may require the use of a database. I am actually in medical school at the moment but have an undergraduate degree in Electrical and Computer engineering so I am generally well-versed in programming.
Perhaps the next time, you post your rubbish, rude and unhelpful comments, you should stop and think that people come to this forum because they need help and not because they want to be told to 'find another job'. In fact, I am quite certain that I could make you look absolutely stupid in any topic of electrical engineering or medicine.
Please do us all a favour and stop polluting this forum with your vapid posts. While I understand that your behavior is likely a compensatory mechanism to cope with your inferiority complex, know that help IS available if you need it.
Edited by: BYS2 on Oct 19, 2011 2:13 AM -
Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field
Hello,
I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
Table structures are mentioned below:
OP:
Name Null Type
OP_NBR NOT NULL NUMBER(4) (Primary Key)
OP_DESC VARCHAR2(50)
OP_PAYLOD_XML CLOB
GM:
Name Null Type
GM_NBR NOT NULL NUMBER(4) (Primary Key)
GM_DESC VARCHAR2(40)
OP_NBR NOT NULL NUMBER(4) (Foreign Key)
GM_PAYLOD_XML CLOB
DM:
Name Null Type
DM_NBR NOT NULL NUMBER(4) (Primary Key)
DM_DESC VARCHAR2(40)
GM_NBR NOT NULL NUMBER(4) (Foreign Key)
DM_PAYLOD_XML CLOB
DE:
Name Null Type
DE_NBR NOT NULL NUMBER(4) (Primary Key)
DE_DESC NOT NULL VARCHAR2(40)
DM_NBR NOT NULL NUMBER(4) (Foreign Key)
DE_PAYLOD_XML CLOB
+++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT
j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
FROM
DE g, DM h, GM i, OP j
WHERE
h.dm_nbr = g.dm_nbr(+) and
i.gm_nbr = h.gm_nbr(+) and
j.op_nbr = i.op_nbr(+)
+++++++++++++++++++++++++++++++++++++++++++++++++++++
I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
Current O/P:
<resultSet>
<Record1>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<DM_PAYLOD_XML1>
<DE_PAYLOD_XML1>
</Record1>
<Record2>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML2>
<DM_PAYLOD_XML2>
<DE_PAYLOD_XML2>
</Record2>
<RecordN>
<OP_PAYLOD_XMLN>
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XMLN>
</RecordN>
</resultSet>
Now i want to change my SQL query so that i get following output structure:
<resultSet>
<Record>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<GM_PAYLOD_XML2> .......
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XML1>
<DM_PAYLOD_XML2> .......
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XML1>
<DE_PAYLOD_XML2> .......
<DE_PAYLOD_XMLN>
</Record>
<Record>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML1'>
<GM_PAYLOD_XML2'> .......
<GM_PAYLOD_XMLN'>
<DM_PAYLOD_XML1'>
<DM_PAYLOD_XML2'> .......
<DM_PAYLOD_XMLN'>
<DE_PAYLOD_XML1'>
<DE_PAYLOD_XML2'> .......
<DE_PAYLOD_XMLN'>
</Record>
<resultSet>
Appreciate your help in this regard!Hi,
A few questions :
How's your first query supposed to give you an XML output like you show ?
Is there something you're not telling us?
What's the content of, for example, <OP_PAYLOD_XML1> ?
I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
What's the db version BTW? -
Splitting complex SQL select query in to independent sequence of small queries.
=====================
Problem Description
=====================
Consider I have the following table structures with approx no. of records in each.
Employee Table
emp_id:
name :
dept_id:
#Approx no. of rows in the table: 1 million
Department Table
dept_id:
dept_name:
#Approx no. of rows in the table: 1 Hundred
=====================
Target Result: is to get the employee name who's id is '100' and the department name he belongs to.
=====================
=====================
Ideal Query : Consider it as COMPLEX QUERY
=====================
select emp.name,dept.name
from employee emp, department dept
where
emp.dept_id = dept.dept_id
and
emp.emp_id = '100';
=====================
Optimized Independent Queries : Consider it as SIMPLE QUERIES
=====================
Now i want to split the above query in to two independent queries.
Query #1
select emp.name
from employee emp
where emp.id = '100';
:: Returns one row as emp.id is unique.
Query #2
select dept.dept_id, dept.name
from department dept
:: Returns 100 rows as there are only 100 rows.
=====================
Need Your Suggestions Here
=====================
If you compare the COMPLEX QUERY against SIMPLE QUERIES, i prefer to use SIMPLE QUERIES, get the results
and compare department id against two results programmatically and then get the final result. I know the database
query engines will do similar query optimization like dividing COMPLEX QUERY to SIMPLE QUERIES and run them
in some specific order to get results faster.
Now is it possible to get the exact sub queries which the database query engine (ANY database query engine) generates
out of complex select query? I mean i don't want to do the splitting manually but i still need those sub-queries.
Can any one help me out please?Why on earth would you want to keep the queries separate? As Tom Kyte would say, databases are born to join!
Providing emp_id has an index on it (and it should, assuming it's the table's primary key!) your "complex" (or, what I would call simple*), it'll most likely be faster than doing it separately. You've not got the context switches for one thing.
If you want to see what the optimizer does with your query, you should run a trace on the query. An explain plan would give you an idea of what it's going to do, too.
In general, doing something like this procedurally is going to almost certainly be worse than doing it in SQL (and by worse, I mean slower).
* I'd hate to see what you'd call some of the monster queries I work with, if you think that query is complex! -
ORA-01006 Using Bind Variables In A Dynamic SQL Contains Query
I have the following dynamic SQL query :-
declare
TYPE typ_sql IS REF CURSOR;
ltyp_sql typ_sql;
lv_sql VARCHAR2(100);
begin
lv_sql := 'SELECT arx_id FROM arx WHERE CONTAINS ';
lv_sql := lv_sql || (arx_full,''(:b1) WITHIN ui'') > 0';
open ltyp_sql FOR v_sql USING ln_id;
fetch ......
close ......
end;
When the code tries to open the cursor it gives the above error. I presume it is the way Oracle is expanding the bind variable but I cannot find anything in the docs to say why this is happening or whether you can do this or not using bind variables ( CONTAINS query ). Any help would be appreciated, thanks,
Stuart.lv_sql || '(arx_full, :b1 || '' within ui'') > 0';
-
Adding columns in a open sql select query
Hi Everyone,
I would like to add the values of n columns of a table and place them in one column, how can i achieve this in open sql.
In oracle native sql the query will look like this:
Select col1 + col2 + col3 AS col
from tab1;
On a similar grounds, i would like to concatenate the contents of n columns into one column. The oracle native sql will look like this:
select col1 || col2 || col3
from tab1;
How can I do this in Open SQL.
Thanks in advance.
Prabhu.Hi Prabhu,
I'm afraid what you're trying to do is not possible using the Open SQL. You will have to get the data from all the three columns into an internal table and then write your own logic to accomplish the same.
data : begin of itab occurs 0,
col1 type i,
col2 type i,
col3 type i,
col4 type i,
end of itab.
field-symbols: <fs_itab> like line of itab.
SELECT COL1
COL2
COL3
INTO TABLE ITAB.
LOOP AT ITAB assigning <fs_itab>.
<fs_itab>-col4 = <fs_itab>-col1 + <fs_itab>-col2 + <fs_itab>-col3.
ENDLOOP.
Regards,
Anand Mandalika. -
SQL select query having more than 1000 values in 'IN' clause of predicate.
Hi,
We are executing a select query from a table and showing it through a front end screen. When the count of values given in the 'IN' clause of predicate are exceeding 1000 , it is throwing error.
eg. select * from Employees where emp.Id. in('111',123','121','3232',........1001 Ids)
We are using Oracle version 10.2.0.
Please suggest how to tackle such issue.
Regards,
Naveen Kumar.C.
Edited by: Naveen Kumar C on Aug 30, 2008 10:01 PMUse a nested table:
create or replace type numbertype
as object
(nr number(20,10) )
create or replace type number_table
as table of numbertype
create or replace procedure tableselect
( p_numbers in number_table
, p_ref_result out sys_refcursor)
is
begin
open p_ref_result for
select *
{noformat} from employees
, (select /*+ cardinality(tab 10) */ tab.nr
from table(p_numbers) tab) tbnrs
where id = tbnrs.nr;
end;
/{noformat}
Using nested tables will reduce the amount of parsing because the sql statement uses binded variables! The cardinality hint causes Oracle to use the index on employees.id. -
SQL SELECT Query Help ..Please its very Urgent!!
Hi All,
I am having Oracle Database whice is storing 1000's of records daily.
I need to select some information based on date and time.
I am having two coloumns for Date and time. The first column(testDate) of type Date stores date as MM/DD/YY format and the second column(testTime)of type Numeric stores the time in seconds.
The Example data is :
testDate ------=-- testTime
11/12/2002 --- 35000
11/12/2002 --- 43000
11/12/2002 --- 45000
11/12/2002 --- 75000
11/13/2002 --- 2000
11/13/2002 --- 3500
11/13/2002 --- 4300
11/13/2002 --- 9800
11/13/2002 --- 23000
11/14/2002 --- 5000
11/14/2002 --- 10000
11/14/2002 --- 15000
How can i write a SELECT Query to get the records of specific date and seconds to next day specific date and seconds.I mean i want all the records between 11/12/2002 --- 43000 seconds to 11/14/2002 --- 1000 seconds.
If any one helps me in this regard iam very thank full to them.Its very urgent for me.
ThanksHi m7nra,
I used the query as
SELECT * FROM table
WHERE testDate + (testTime/(24*60*60)) BETWEEN TO_DATE('MM/DD/YYYY','12.11.2002') AND TO_DATE('MM/DD/YYYY','14.11.2002')
its giving DATE FORMAT NOT RECOGNIZED error.
The Example data is :
testDate ------=-- testTime
11/12/2002 --- 35000
11/12/2002 --- 43000
11/12/2002 --- 45000
11/12/2002 --- 75000
11/13/2002 --- 2000
11/13/2002 --- 3500
11/13/2002 --- 4300
11/13/2002 --- 9800
11/13/2002 --- 23000
11/14/2002 --- 5000
11/14/2002 --- 10000
11/14/2002 --- 15000
infact i need all the records between 11/12/2002 --- 43000 seconds to 11/14/2002 --- 1000 seconds.
Please help me to find a full query beacuse iam very new to Oracle.
Thanks,
S R Mannava -
How to display data in a required format by SQL Select Query?
Hi,
i have a table named HR_PAYSLIP consisting of 4 columns empno, month, year, basic pay.
well i like to display the month wise basic salary
through a select query from the table
like this format;
EMPNO JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
00094 122 153 145 224 245 545 114 544 444 111 555 222
00095 233 123 145 224 205 545 114 444 444 111 555 222
00096 163 123 145 224 215 545 114 551 444 111 555 222
00097 154 123 145 294 255 545 114 144 444 111 555 222
conditions:
where condition: where year = 2007
the employee no may be more and that must be displayed only one time like above for year,
and if the basic salary is zero for a month then it should be displayed as zero for a particular month as below
eg:
EMPNO, JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
00094 122 153 0 224 245 545 114 544 444 111 555 222
Table Structure:
EMPNO NUMBER(10)
YEAR NUMBER(4)
MONTH NUMBER(2)
BASIC_PAY NUMBER(15)
Pls note: Month is stored in the table as 1 to 12.From the FAQ
{message:id=9360005} -
Hi friends ,
i have a table like
table ABC(
essay_id number(2),
line_id number(3),
line_t varchar2(100)
and here my table data goes..
essay_id line_id line_t
1 1 abc
1 2 def
1 3 ghi
2 1 klm
2 2 nop
here a single essay is stored as multiple lines in diff rows with same essay id and diff line id..
here i want to concatenate all the lines associated to same essay id..
for essay_id 1 ..output should be abcdefghi
for essay_id 2.. output should be klmnop
i did this with the help of cursor..
bt my question is ..
can we achieve this with a single select query...?
is it possible..
Please help me on this..
Thanks in advance
Regards,
JeyanthiWhat version of Oracle are you using?
Tim Hall has a page on the various string aggregation techniques that are available. The approaches that are available will depend heavily on the Oracle version.
Justin -
Until runtime I don't know the table name and column-name on which I have to do a select.
Here is my SQL:
SELECT single <b>w_sum_col_name </b> FROM (w_tbl_name)
INTO ZOH_AUDIT-ZOH_NET1
WHERE REQUID = ZOH_AUDIT-REQUID.
My SQL fails when I have SUM(any_column) in the string w_sum_col_name. However it works if its a just a column name of the table. Failure is when the w_sum_col_name string has an aggregate function.
Error is ..SAPSQL_ILLEGAL_AGGREGATE" CX_SY_DYNAMIC_OSQL_SYNTAX
Any alternatives for my requirement is appreciated.Try this code.
REPORT zreport NO STANDARD PAGE HEADING MESSAGE-ID zfi
LINE-COUNT 65
LINE-SIZE 120.
PARAMETERS: p_matnr LIKE mara-matnr.
DATA: mytable LIKE dd02l-tabname,
fields(50) TYPE c OCCURS 0 WITH HEADER LINE,
labst LIKE mard-labst.
TABLES: mard.
DEFINE select_statement.
select (&1) into &2
from (&3)
where matnr = p_matnr.
endselect.
END-OF-DEFINITION.
fields = 'SUM( LABST )'.
APPEND fields.
mytable = 'MARD'.
select_statement fields[] labst 'MARD'.
WRITE:/ labst.
Maybe you are looking for
-
Hello friends We don't have a Basis guy here. I am an XI certified person wearing different caps. I am trying to append a structure to VBAK and when I try to make the change it is asking for access key. I looked at other SDN postings regarding this b
-
How to make separately editable blocks in one widget?
How to make separately editable blocks (Width, Height, BGColor,...) in one widget?
-
Question about installing Elements 11 on new iMac
I have a DVD version of Photoshop Elements 11 that I purchased with a new camera last year, and a new iMac. I am having installation problems with it. When I tried to install it, I get a dialog box that says it failed to initialize. Please advise.
-
No Toolbar Group - How to remove buttons
Hi Everyone I am working in CRM 4.0 In sales order application, detail area 2 from prices tab i have to remove buttons of "Add Entry", "Delete Entry", "Update Prices". However BLueprint application builder and CRMC_PCUITOOLS transaction does not give
-
Keynote for Beginners Series now on YouTube
Hiya, I just began posting a 36 part series on Keynote for Beginners on YouTube. Have a look, I think you will find it beneficial! Subscribe so you can stay up with the latest episodes! http://www.youtube.com/watch?v=NQQwZ9zePvM Happy Keynoting! Pete