Please send me select statement for the below query.....
FOR i IN 1..9 LOOP
IF shift(i) IS NULL THEN
FOR y IN i+1..9 LOOP
IF shift(y) IS NOT NULL THEN
shift(i) := shift(y);
shift(y) := NULL;
EXIT;
END IF;
END LOOP;
END IF;
END LOOP;
please how to write select query to replace loops in above code
CREATE or REPLACE function MyFun(
code_1 IN VARCHAR2,
code_2 IN VARCHAR2,
code_3 IN VARCHAR2
)RETURN INTEGER IS
out_param INTEGER:=0;
TYPE t_cos IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
shift t_cos;
i NUMBER;
y NUMBER;
BEGIN
shift(1) := TRIM(code_1);
shift(2) := TRIM(code_2);
shift(3) := TRIM(code_3);
FOR i IN 1..3 LOOP
IF shift(i) IS NULL THEN
FOR y IN i+1..3 LOOP
IF shift(y) IS NOT NULL THEN
shift(i) := shift(y);
shift(y) := NULL;
EXIT;
END IF;
END LOOP;
END IF;
END LOOP;
For i IN 1..3 Loop
IF substr(shift(i),1,1) = 'E' THEN
out_param := shift(i);
EXIT;
ELSE
out_param := NULL;
END IF;
END LOOP;
out_param := 1;
RETURN (out_param);
END;
For Ex we have 100 recors this loops i.e For loops executes more than 100 times we need to avoid this thing and replace for loop's and write select stmt on this.
Edited by: 867554 on Jun 22, 2011 6:31 AM
Similar Messages
-
Alternate statement for the below
hi every one please suggest me the below
am working on syntactical corrections in up gradation project
i have one statement like
" CALL TRANSACTION 'SE11' USING BDCDATA MODE 'A' AND SKIP FIRST SCREEN." It is showing error like The addition "AND SKIP FIRST SCREEN" cannot be used with "CALL TRANSACTION... USING ...".
so any other alternate statement for this it is very urgent
Thanks in adv
Rewards will be given
Sunnyyes the alternatives are ther but i do not change the meaning like i need to call the first se11 screen as well as need to skip the first screen
we con't use 'USING' and 'AND SKIP FIRST SCREEN' at a time but here they used in 4.6b it is not possible in ECC6 so please give correct statement with out changing the meaning
Thanks in ADV -
Reduce the execution time for the below query
Hi,
Please help me to reduce the execution time on the following query .. if any tuning is possible.
I have a table A with the columns :
ID , ORG_LINEAGE , INCLUDE_IND ( -- the org lineage is a string of ID's. If ID 5 reports to 4 and 4 to 1 .. the lineage for 5 will be stored as the string -1-4-5)
Below is the query ..
select ID
from A a
where INCLUDE_IND = '1' and
exists (
select 1
from A b
where b.ID = '5'
and b.ORG_LINEAGE like '%-'||a.ID||'-%'
order by ORG_LINEAGE;
The only constraint on the table A is the primary key on the ID column.
Following will be the execution plan :
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=406 Card=379 Bytes=2
653)
1 0 SORT (ORDER BY) (Cost=27 Card=379 Bytes=2653)
2 1 FILTER
3 2 TABLE ACCESS (FULL) OF 'A' (Cost=24 Card
=379 Bytes=2653)
4 2 TABLE ACCESS (BY INDEX ROWID) OF 'A' (Co
st=1 Card=1 Bytes=6)
5 4 INDEX (RANGE SCAN) OF 'ORG_LINEAGE'
(NON-UNIQUE)I order it by the org_lineage to get the first person. So it is a result problem? The order by doesn't give you the first person, it gives you a sorted result set (of which there may be zero, one, or thousands).
If you only want one row from that, then you're spending a lot of time tuning the wrong query.
How do you know which ORG_LINEAGE row you want?
Maybe it would help if you posted some sample data. -
Please explain functional dependency & normalization for the below relation
For relation:
DEPTINFO ( DEPT_NUM, DOFF_NUM, DBUDGET, MGR_NUM, EMP_NUM, PROJ_NUM, PLEADER, EOFF_NUM, EMAIL, EJOBTITLE, EFFORT%, YEAR, SALARY, PBUDGET, BLDG )
where :
Each employee works for one department.
Each employee has one office.
Each employee has one email.
Each employee has one job title.
Employees can work on more than one project.
Each employee office is assigned to one department.
Each project has its own project budget.
Each project has its own project leader.
Each department is assigned a unique office.
Each department office is in a unique building.
Each department has its own department budget.
Each department has a unique manager.
Each employee is assigned a percentage of effort he/she is to devote to a project to which he/she is assigned.
Each year an employee is allocated a unique salary for that year.
1.a Convert each of the above statements to a functional dependency
1.b Fully normalize the above relation.9d5c95e3-f768-4078-893d-e16d5d6ba39e wrote:
from my observation the answer for first question is
EMP#->{DEPT# ,EOFF#,EMAIL,EJOBTITLE,EFFORT%,SALARY}
EOFF#->DEPT#
PROJ#->{PBUDGET,PLEADER}
DEPT#->{DOFF#,BLDG,DBUDGET,MGR#}
DOFF#->BLDG
is that correct
Just a side observation ... when you get to actually defining tables and columns, you really don't want to be using special characters, as they are often interpreted as meta-characters. So get in the habit now:
Not this
But this
EMP#
EMP_NUM
DEPT#
DEPT_NUM
EOFF#
EOFF_NUM
EFFORT%
EFFORT_PCT
PROJ#
PROJ_NUM
DOFF#
DOFF_NUM
MGR#
MGR_NUM -
How to frame a SQL for the below Query
i have a SQL query
select x,y from table1 where x=1
output
x y
1 a
1 b
where a means alpha and b means beta
select x,z from table2 where x=1
Output
x z
1 B
How do i build a query to achieve a following output
x z y1 y2
1 b alpha beta
Please noete : Instead of 'a' and 'b' i want it to be replaced by words and
i want two rows value to appear in one column together....Maybe this is what you want ... I'm under the impression of trying to catch a moving target here.
WITH tb_clr_doc_version_defs AS (SELECT 'A' datatype_cd,
13 doctype_id
FROM dual
UNION
SELECT 'A' datatype_cd,
14 doctype_id
FROM dual
tb_clr_doc_field_defs AS (SELECT 'AccountNb_ID' fieldname_nm,
13 doctype_id
FROM dual
UNION
SELECT 'TaxIDNb_NO' fieldname_nm,
13 doctype_id
FROM dual
SELECT datatype,
MAX(DECODE(fieldname_nm, 'AccountNb_ID', fieldname_nm, NULL)) fieldname_nm1,
MAX(DECODE(fieldname_nm, 'TaxIDNb_NO' , fieldname_nm, NULL)) fieldname_nm2
FROM (SELECT t1.doctype_id,
DECODE(t1.datatype_cd, 'A', 'afp', 'L', 'line', 'M', 'mixed', t1.datatype_cd) datatype,
t2.fieldname_nm
FROM tb_clr_doc_version_defs t1,
tb_clr_doc_field_defs t2
WHERE t1.doctype_id = t2.doctype_id(+)
GROUP BY doctype_id, datatype
; -
why can i not send a debat, -error massage - " Please try again later m5" i try to send a crash reports for the Photoshop crashes. Is it to long ?????
Hi,
Please download the updates directly from the link below:
WIN: All Adobe CC 2014 Updates: The Direct Download Links for Windows | ProDesignTools
MAC: All Adobe CC 2014 Updates: The Direct Download Links for Mac OS | ProDesignTools
Regards,
Sheena -
good night I have the question of a message that I have received in my mobile, if I won 715.000 pounds sterling on a lottery contest the Apple company, please let me answer if this is real lottery to send my personal data for the claim this prize.
Scam. Do not divulge any personal or financial information.
-
Need Select statement for fetch the details
Hi
i want to fetch particular customer wise sales orderds and that sales order No and date of sales order was created.. and that sales order related PO No and Materials ..
for this.. how can i write an executable programm.. is it needed to define seperate internal tables or single internal table is enough ?
what is the select statement for fetching all these details..
any help will be appriciated
Thanks
Bbaucustmer master table is KNA1 knb1 knbk
sales data tables r VBAK VBAP VBEP
Material data MARA, MARAC, MARD
PO RELATED ekko ekpo eket
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 13, 2008 3:04 PM -
How to deal with BRS for the below scenario?
Hi,
I would like to know the solution for the below scenario for BRS:
I have a customer who was maintaining their accounts with Tally software for their previous Financial Year. This year they have shifted to SAP B1 2005B. They have issued few cheques for their vendors in the month of march 2008 which has been realised in the month of April 2008. As per Tally, the closing balance of their bank is 8 Lakh but as per the bank statement, their closing balance is 23 Lakhs. In SAP, the opening Balance for the bank is considered as 23 Lakhs. Now there are 15 Lakh worth cheques which were not realised for the month of March 2008.
Example:
abc a/c - 3Lakh
def a/c - 5lakh
xyz a/c - 7 lakh
How do i reconcile for this scenario and what procedures do i follow in SAP?
Thanks and Regards,
KaushalHi Kamlesh,
Thanks for your response.
Actually, In the "Process External Bank Statement" window, i see that there are few entries which is for the previous year and which has not been reconciled. I have never worked practically on BRS and hence, i am scared to make any changes in the clients database without being confident on what i am doing. I need to reconcile for one of their Bank a/c for the month of April '08. I have the copy of the statements for the month ending 31st Mar 08 and 30th Apr 08. The closing balances are as below:
31/03/08 - 2300000.00
30/04/08 - 3100000.00
Now my OB for Bank a/c for April '08 in SAP is 2300000.00 Dr.
When i go to External Bank Reconciliation - Selection Criteria Screen (Manual Reconciliation), here are the detail that i enter:
Last Balance: INR -7,000,000.00000 (Grayed out by the system)
Ending Balance: INR -3,100,000.00000 (Entered by me)
End Date: 30/04/08 (Entered by me)
"Reconciliation Bank Statement" Screen opens up and shows the below balances in the screen:
Cleared Book Balance: INR -7,000,000.00000
Statement Ending Balance: INR -3,100,000.00000
Difference: INR 3,800,000.00000
As per the Bank statement, i have found all the transactions listed out here for the month of Apr '08 but, i also found that the open transactions for the previous month from April '08 have been lying in "Process External Bank Statement" window.
Could you please help me solve my issue as to what needs to be done or could you also get me some links from where i can get few documents for processing External Bank Reconciliations?
That will be of a great help for me. I need steps as to what needs to be done first and then the next so that i can arrive at the correct closing balance for the month April '08.
Thanks in Advance....
Regards,
Kaushal -
UDF reqiured for the below reqiurement
Hi ALL,
Can any one help me out by sending the javacode for the below reqirement.
My sender data is coming from database.So based on 2 fields i have to spilt the idocs at target side.
my reqirement is
1)Material number and 2)Batch
Case 1: For the same material number if the batch is empty spilt it into idocs
I.e material number -
> 123
batch -
> empty
123
empty
In the above case it must be splited into 2 idocs
Case 2: For the same material number if the batch is same then spilt these data into idocs
material number -
> 123
batch -
> 11
123
11
In the above case it must be splited into 2 idocs
Case 3: For the same material number if the batch is different then combine these data into one idoc
material number -
> 123
batch -
> 11
123
12
In the above case it must be combined into 1 idoc
however if material number changes new idoc must be cretaed.
Good points will be givenHi Raj,
Please see the xml structure.It does not come in the sorted order
<?xml version="1.0" encoding="utf-8" ?>
- <row>
<BEGIN />
<IDOC_ID>5c6b4851bb25583baa47b0c8ff6b8ce4</IDOC_ID>
<TS>2010-03-30 15:04:52.781957</TS>
<STATE>1</STATE>
<PLANT>2401</PLANT>
<COUNTRYCODE />
<STGE_LOC>0100</STGE_LOC>
<DOC_DATE>20100330</DOC_DATE>
<MATERIAL>000000000001201501</MATERIAL>
<BATCH />
<SERIALNO>000000000000000000</SERIALNO>
<ZREASON>45</ZREASON>
<ZQUANTITY>00000000000003-</ZQUANTITY>
<ZQUAN_UNIT>STK</ZQUAN_UNIT>
<IDOC_ID>5c6b4851bb25583baa47b0c8ff6b8ce4</IDOC_ID>
</row>
- <row>
<BEGIN />
<IDOC_ID>5c6b4851bb25583baa47b0c8ff6b8ce4</IDOC_ID>
<TS>2010-03-30 15:04:52.781957</TS>
<STATE>1</STATE>
<PLANT>2401</PLANT>
<COUNTRYCODE />
<STGE_LOC>0100</STGE_LOC>
<DOC_DATE>20100330</DOC_DATE>
<MATERIAL>000000000001201501</MATERIAL>
<BATCH />
<SERIALNO>000000000000000000</SERIALNO>
<ZREASON>45</ZREASON>
<ZQUANTITY>00000000000002-</ZQUANTITY>
<ZQUAN_UNIT>STK</ZQUAN_UNIT>
<IDOC_ID>5c6b4851bb25583baa47b0c8ff6b8ce4</IDOC_ID>
</row> -
Select statement for retrieving infotype 1005 values w,r,t payscale
Hi All,
could you pls help me for the below requirement
"select statement for retrieving infotype 1005 values with respect to the pay scale level.
because pay scale level is having range of values in the infotype"
Thanks in advance
Prasad
Please try it yourself first.
Edited by: Suresh Datti on Aug 9, 2009 4:52 PMHi,
Code which you have written is correct when the R_DATE is having LOW and HIGH values, if the R_DATE is having only LOW value then this will be wrong, becuse if the R_DATE is having only LOW then OPTION value is not BT is should be EQ
Regards
Sudheer -
Please Help!!!
How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
January 2014 January
2013 +/-
Region Entry Exit Total Entry Exit Total (Total of Jan2014-Total of Jan2013)
A 2 3
40 5 7 30 40-30= 10What is a table structure? Sorry cannot test it right now..
SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
FROM tbl
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Select statement for summing values in column?
How to write a select statement for sap standard table which contains data as given below
col1 col2
A 10
A 20
A 30
B 50
B 60
C 70
Need the output of select in internal table as given below
A 60
B 110
C 70
Regards,
RachelThanks for all the valuable input.
Below I have used sum in select statement(check case 2"),but i am not getting required o/p.
Kindly guide me.
case1 :
select aebeln aebelp bpackno bmenge
into corresponding fields of table itab
from ( eslh as a inner join esll as b
on bpackno = apackno )
where a~ebeln = 6000000100
and a~ebelp = 00010
and a~packno = '0000001025'
order by aebeln aebelp b~packno .
O/p for the above .
ebeln ebelp packno menge
6000000100 00010 0000001025 6.000
6000000100 00010 0000001025 5.000
6000000100 00010 0000001025 2.000
6000000100 00010 0000001025 1.000
6000000100 00010 0000001025 2.000
case2:
select aebeln aebelp bpackno sum( bmenge )
into corresponding fields of table itab
from ( eslh as a inner join esll as b
on bpackno = apackno )
where a~ebeln = 6000000100
and a~ebelp = 00010
and a~packno = '0000001025'
group by aebeln aebelp b~packno
order by aebeln aebelp b~packno .
6000000100 00010 0000001025 0.000
Edited by: Rachel on Nov 25, 2008 11:45 AM
Edited by: Rachel on Nov 25, 2008 11:46 AM -
Regarding select statement for this requirement
Hi................
good evening
here is a requirement.
i want to retrieve data from the following table.but how to join these table is my dought.
tables fields
t001w--werks " plant id
t001w--name1 " pl;ant name
t001w--regio " plant address
ekko--ebeln " purchase order
ekko-erdat : creation date
ekko-ernam "name of the person
ekpo-ebelp " item
ekpo-bstyp "purchase order type
eket-erdat " delivery date
mara-matnr " material number
these are the tables and fields.now we want to retrive data from these tables
how we have to code select statement.
selection-screen is
plant id
order type
delivery date
please provide select statement for this requirement.
thanks and regards.
k.swaminath reddy.Is this what you are looking for?
SQL> CREATE OR REPLACE FUNCTION f_team
2 RETURN VARCHAR2
3 IS
4 s_return VARCHAR2(500);
5 BEGIN
6 FOR i IN ( select team from t_team order by 1) LOOP
7 s_return := s_return || i.team || ', ';
8 END LOOP;
9
10 RETURN substr(s_return, 1, length(s_return) - 2);
11 END;
12 /
Function created.
SQL> SELECT f_team FROM dual;
F_TEAM
Australia, Bangladesh, England, India, Kenya, Pakistan, South Africa, UAE, USA, West Indies, Zimbabwe
SQL> -
Equivalent select statement for complex selection
HI,
What is the equivalent select statement for below mentioned condition.
SELECT-OPTIONS : SALEDOCU FOR VBAK-VBELN OBLIGATORY,
DATE FOR VBAK-ERDAT OBLIGATORY,
CHANEEL FOR VBAK-VTWEG,
SALETYPE FOR VBAK-AUART OBLIGATORY DEFAULT 'QT'
NO INTERVALS NO-EXTENSION.
Regards,
John.hi,
you can use following code.
tables vbak.
data : begin of t_vbak occurs 0.
include structure vbak.
data : end of t_vbak.
select * from vbak into table t_vbak where
vbeln in saledocu and
erdat in date and
vtweg in chaneel and
auart in saletype.
Hope this helps.
Regards,
Shashank
Maybe you are looking for
-
Deliver locally and forward to alternate domain?
Is there a simple setting that would allow Postfix on Mac OS X to deliver messages locally as well as relay a copy to an alternate domain? For example: Let's say I have my server configured to deliver mail locally for '[email protected]' and I want t
-
No display of iview content after cache properties are set
Hello, In an effort to improve the portal performance we activated the Iview Load Parameters(Cache level, validity, client side caching etc) and after that we are not seeing any content of the iview in the portal. Cache level - Shared Cache validity
-
Problem using SpryData.js ver 0.49 preview 1.7
Try http://www.stjohnhistoricalsociety.org/PhotographsC1a.htm which uses the 1.7 preview version of SpryData.js Compare with http://www.stjohnhistoricalsociety.org/PhotographsC1.htm which uses the 1.6.1 version. In my error console window I receive S
-
Hi Please suggest me... How to increase the length of Complaint Description on the ICSS screen. (E-Commerece 4.0) Our business requirement is to increase the field length from 40 char to 120 char early reply would be highly appreciated regards G.Venu
-
Numbers adding extra rows to CSV files
When I open a CSV file Numbers just adds in a blank row between each row. What is happening?