Query to display sysdate 'n' number of times...
hi all,
i need to get sysdate 'n' number of times as output. That 'n' will be passed at runtime....
Thank You...
Why not?
satyaki>
satyaki>select sysdate from dual connect by level <= &n;
Enter value for n: 3
old 1: select sysdate from dual connect by level <= &n
new 1: select sysdate from dual connect by level <= 3
SYSDATE
29-DEC-08
29-DEC-08
29-DEC-08
Elapsed: 00:00:00.08
satyaki>/
Enter value for n: 7
old 1: select sysdate from dual connect by level <= &n
new 1: select sysdate from dual connect by level <= 7
SYSDATE
29-DEC-08
29-DEC-08
29-DEC-08
29-DEC-08
29-DEC-08
29-DEC-08
29-DEC-08
7 rows selected.
Elapsed: 00:00:00.00
satyaki>Regards.
Satyaki De.
Similar Messages
-
How to display the rows number of times by giving the column values?
Hi All,
I want to display the rows number of times as the value exists in num column in the below query
with t AS
( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
UNION ALL
SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
UNION ALL
SELECT 'krishna' NAME, 'hyd' LOC, 1 NUM FROM DUAL )
SELECT T.* FROM T
CONNECT BY ROWNUM <= NUM
Expected output:
venkatesh hyd 2
venkatesh hyd 2
prasad hyd 3
prasad hyd 3
prasad hyd 3
krishna hyd 1Edited by: Nag Aswadhati on Nov 1, 2012 12:34 AMNag Aswadhati wrote:
Hi All,
I want to display the rows number of times as the value exists in num column in the below query
Expected output:
venkatesh hyd 2
venkatesh hyd 2
prasad hyd 3
prasad hyd 3
prasad hyd 3
krishna hyd 1Using Connect By:-
with t AS
( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
UNION ALL
SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
UNION ALL
select 'krishna' name, 'hyd' loc, 1 num from dual )
select t.name, t.loc
from t
connect by level <= num
and name = prior name
and (prior sys_guid() is not null);
NAME LOC
krishna hyd
prasad hyd
prasad hyd
prasad hyd
venkatesh hyd
venkatesh hyd
6 rows selected -
Query to display sales invoice number by sales order number
Hi,
Welcome you post on the forum.
You may check this first:
http://wiki.sdn.sap.com/wiki/display/B1/SAPB1SQLD-SLLapsedDaysOrdertoDeliveriesOrderDetailsVer3
Thanks,
GordonI've read the article and strugled and other articles for this but I haven't achieved the goal - I can display list of SO and linked Deliveries and linked A/R Invoices and A/R Memos but basing on date and client changes within the query itself.
The current goal is to have a query to ask for GP code and ask for DocDate to get list of Sales Order document numbers and A/R Invoices document numbers and A/R Credit Memos document numbers.
The ideal result would be to get final quantities of products from all further existing data with possibility to use it in Excel's (office 2007-2010) SQL native client basing on SO document number parameter.
Maybe it is not possible?
Any help would be appreciated.
Thank you,
Tomasz -
QUERY WHICH COUNTS NUMBER OF TIMES WORDS/LETTER APPEAR IN SENTENCE - Thanks
I have this query below
it gives the number of times a txn is hign comfort and Approved
.. nyumber of times txn is meduim comfort and approved etc.
There is a futher line whihc shows the number of times txn is blacklisted BL COUNT.
I am trying to get line of query which can show me the number of times txn is approved, is high comfort and blcklisted ( the same applies for
wl - watch listed)
The query i am using
SUM
(CASE
WHEN cc.Comment
LIKE ('BL(%') and cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=High Comfort%')
THEN 1
ELSE 0 END)AS hbcl - NO RESULTS BEING GIVEN
pLEASE CAN ANYONE HELP,. THANKS
QUERY
USE RiskManagementReporting
GO
DECLARE
@StartDate DATETIME,
@EndDate DATETIME
SET @StartDate
= '2014-01-01 00:00:00'
SET @EndDate
= '2014-03-31 23:59:59'
SELECT
CONVERT
(VARCHAR(10),
mt.OPacket_TransactionTime, 102)
AS [Date],
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=High Comfort%')
THEN 1 ELSE 0
END) AS [A - HighC],
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=Medium Comfort%')
THEN 1 ELSE 0
END) AS [A - MediumC],
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=Low Comfort%')
THEN 1 ELSE 0
END) AS [A - LowC],
SUM
(CASE
WHEN cc.Comment
LIKE ('Declined%')
AND cc.Comment
LIKE ('%ComfortLevel=Low Risk%')
THEN 1 ELSE 0
END) AS [D - LowR],
SUM
(CASE
WHEN cc.Comment
LIKE ('Declined%')
AND cc.Comment
LIKE ('%ComfortLevel=Medium Risk%')
THEN 1 ELSE 0
END) AS [D - MediumR],
SUM
(CASE
WHEN cc.Comment
LIKE ('Declined%')
AND cc.Comment
LIKE ('%ComfortLevel=High Risk%')
THEN 1 ELSE 0
END) AS [D - HighR],
SUM
(CASE
WHEN cc.Comment
LIKE ('BL(%')
THEN 1 ELSE 0
END) AS [BL Count],
SUM
(CASE
WHEN cc.Comment
LIKE ('WL(%')
THEN 1 ELSE 0
END) AS [WL Count],
SUM
(CASE
WHEN cc.Comment
LIKE ('Marked as Touched%')
THEN 1 ELSE 0
END) AS [Touched by DRT],
COUNT
(mt.csnTransactionId)
AS [Sent to DRT]
FROM MatchedTransaction mt
WITH (NOLOCK)
LEFT
JOIN CustomerComment cc
WITH (NOLOCK)
ON (mt.csnTransactionId
= cc.SenderMTCN
AND cc.InsertDate
BETWEEN @StartDate AND
DATEADD (D, 1, @EndDate)I have adjusted this as
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=High Comfort%')
AND cc.Comment
LIKE ('%BL(%')THEN 1
ELSE 0 END)
AS hcbl,
Still no result -
Query to display PO number and wip_entity_name
hi
i have this requirement as to add the following to an existing query (based on standard tables)
SELECT
MMT.INVENTORY_ITEM_ID DT_INVENTORY_ITEM_ID
, MMT.ORGANIZATION_ID DT_ORGANIZATION_ID
, MMT.TRANSACTION_DATE DT_TRANSACTION_DATE
, MMT.TRANSACTION_SOURCE_ID DT_VOUCHER_NO
, NVL(MMT.TRANSACTION_COST,0) DT_TRANSACTION_COST
, MTT.TRANSACTION_TYPE_NAME DT_TRANSACTION_TYPE_NAME
, NVL(MMT.NEW_COST,0) DT_NEW_COST
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),1,MMT.PRIMARY_QUANTITY,0)
DT_QTY_IN
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),-1,MMT.PRIMARY_QUANTITY,0) * -1
DT_QTY_OUT
FROM
MTL_MATERIAL_TRANSACTIONS MMT
, MTL_TRANSACTION_TYPES MTT
WHERE
MMT.PRIMARY_QUANTITY <> 0
AND MMT.TRANSACTION_TYPE_ID NOT IN (101,120,80)
/* ABOVE CONDITION TO EXCLUDE OPENING BALANCE TRANSACTIONS
AND AVERAGE COST UPDATE
AND MMT.SUBINVENTORY_CODE <> 'OM'
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.TRANSACTION_DATE BETWEEN :P_START_DATE AND :P_END_DATEwhenever the MTL_TRANSACTION_TYPES MTT.TRANSACTION_TYPE_NAME='PO Receipt' then display the PO number
similarly WHEN MTL_TRANSACTION_TYPES MTT.TRANSACTION_TYPE_NAME= Wip Component Issue then display wip_entity name
P_START_DATE AND :P_END_DATE i have put is 01-jan-2011 and 28-feb-2011
once i add these conditions to the query ,the query displays less amount of rows ie 2014 rows whereas the first query used to return 2357 rows
this is the modified query
SELECT
MMT.INVENTORY_ITEM_ID DT_INVENTORY_ITEM_ID,
case when MTT.TRANSACTION_TYPE_NAME='WIP component issue' then wip.WIP_ENTITY_NAME
when MTT.TRANSACTION_TYPE_NAME='WIP Component Return' then wip.WIP_ENTITY_NAME
when MTT.TRANSACTION_TYPE_NAME='NP-Material Request' then wip.WIP_ENTITY_NAME
end job_number
, MMT.ORGANIZATION_ID DT_ORGANIZATION_ID
, MMT.TRANSACTION_DATE DT_TRANSACTION_DATE
, MMT.TRANSACTION_SOURCE_ID DT_VOUCHER_NO
, NVL(MMT.TRANSACTION_COST,0) DT_TRANSACTION_COST
, MTT.TRANSACTION_TYPE_NAME DT_TRANSACTION_TYPE_NAME
, NVL(MMT.NEW_COST,0) DT_NEW_COST
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),1,MMT.PRIMARY_QUANTITY,0)
DT_QTY_IN
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),-1,MMT.PRIMARY_QUANTITY,0) * -1
DT_QTY_OUT
FROM
MTL_MATERIAL_TRANSACTIONS MMT
, MTL_TRANSACTION_TYPES MTT
,WIP_ENTITIES WIP
WHERE
MMT.PRIMARY_QUANTITY <> 0
AND MMT.TRANSACTION_TYPE_ID NOT IN (101,120,80)
AND MMT.TRANSACTION_SOURCE_ID = WIP.WIP_ENTITY_ID(+)
/* ABOVE CONDITION TO EXCLUDE OPENING BALANCE TRANSACTIONS
AND AVERAGE COST UPDATE
AND MMT.SUBINVENTORY_CODE <> 'OM'
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.TRANSACTION_DATE BETWEEN :P_START_DATE AND :P_END_DATE
union
SELECT
MMT.INVENTORY_ITEM_ID DT_INVENTORY_ITEM_ID,
case
when MTT.TRANSACTION_TYPE_NAME='PO Receipt' then PHA.SEGMENT1 end job_number
, MMT.ORGANIZATION_ID DT_ORGANIZATION_ID
, MMT.TRANSACTION_DATE DT_TRANSACTION_DATE
, MMT.TRANSACTION_SOURCE_ID DT_VOUCHER_NO
, NVL(MMT.TRANSACTION_COST,0) DT_TRANSACTION_COST
, MTT.TRANSACTION_TYPE_NAME DT_TRANSACTION_TYPE_NAME
, NVL(MMT.NEW_COST,0) DT_NEW_COST
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),1,MMT.PRIMARY_QUANTITY,0)
DT_QTY_IN
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),-1,MMT.PRIMARY_QUANTITY,0) * -1
DT_QTY_OUT
FROM
MTL_MATERIAL_TRANSACTIONS MMT
, MTL_TRANSACTION_TYPES MTT
,PO_HEADERS_ALL PHA
,PO_LINES_ALL POL
WHERE
MMT.PRIMARY_QUANTITY <> 0
AND MMT.TRANSACTION_TYPE_ID NOT IN (101,120,80)
AND MMT.TRANSACTION_SOURCE_ID=POL.PO_LINE_ID
AND PHA.PO_HEADER_ID=POL.PO_LINE_ID
/* ABOVE CONDITION TO EXCLUDE OPENING BALANCE TRANSACTIONS
AND AVERAGE COST UPDATE
AND MMT.SUBINVENTORY_CODE <> 'OM'
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.TRANSACTION_DATE BETWEEN :P_START_DATE AND :P_END_DATEkindly guide
thanking in advanceHi,
There could be nothing wrong in your Query, as all the WiP Assembly completions, WIP Negative Component Issue ,WIP Negative Component Return etc transaction types could be there in the Mat txns table for this period. Please check them -
hi my iphone was fully charged and turned its self off, i have tried to turn it back on and reset it, but no luck so i have plugged it in to my pc and it displays the apple logo and then goes back off i have tried this a number of times with no success anyone got any idears?
Try here:
iOS: Not responding or does not turn on -
BW Reporting - How to Count the number of times a query is executed
Hi All,
How do we get a report that enable us to get a count of number of times a report is executed? Example below:
Info-provider Report Name Frequency
PA_C01 Headcount 24 times
Any idea?
Many thanks all.
Mark Ng.Hi,
1. Use Tcode = ST03N (Work Load Monitor)
2. Choose Expert mode.
3. Click on your system host name
4. Click on Transaction Profile, then you can find out the all tasks.
5. Select which ever you want to see details for queries.
Regards,
Srini Nookala -
Multiple records displayed on form at one time- 2 lines for each record
Hello,
I have a canvas in which I want to display 8 records at at time, so in the data block I specified 8 as the "number of records displayed" value.
However, the record has too many fields to display on 1 vertical line, so I want to split the fields into two separate lines, so there will still be 8 records but each in two lines.
How do I do that?
I'm using Forms 10g. The block is a database block using FROM CLAUSE QUERY , and the canvas is stacked.
ThanksSandy,
You will need to set the "Distance Between Records" property for each item in the Multi-Record Block. This will increase the space between rows so you can stack them into two rows. Unfortunately, you can't set this property at the block - so you have to set it for each displayed item.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Display Line/Row number in Grid
Hi,
How to display the row number (1,2,3...) in a grid?
Should I go only by changing the query?
Or is there any SDK supported way of doing that?
Please help me with this information.
Thanks.
GeethaHi Geetha,
didn't have time to answer your earlier ...
you are looking for something like
SELECT (SELECT COUNT(*)
FROM OCRD T2
WHERE T2.CardCode <= T1.CardCode) as RowIndex, T1.*
FROM OCRD T1
ORDER BY RowIndex
this sample will display a row number of the complete ocrd table -
Displaying one record at a time
Is any body able to help me? I need to display one record at a time from a Select statement.
Could I copy the results of the Select query from a table into an array for later display or is there a better alternative.
Please, any part knowledge with regard to the above would be usefull.
Regards
EddieWhat application do you want to use to display the data?
You can use "rownum" in your SQL statement to ensure that you only get record N of a query. Asktom has a good article on this sort of windowing
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
More commonly, however, you'll write a SQL query that returns all the rows, fetch a small number, display those to the user, and then fetch more records.
Justin -
Convert a Number to time in Oracle
Hi,
In a oracle database table i have a colum that gives the value from 0 to 2359. I want to convert Number to time in Oracle. Any i dea on the query for this.
I have tried
SELECT TO_CHAR('2342','HH:MI') "Time"
FROM dual;
but it is not functioning.
ThanksThe Number that i want to convert to Time is of the
columns of the same table and depending on its value,
i want to display it as Time.
Thanks,Well it sounds like you certainly have no clue what you are doing whatsoever. I predict a bright future for you.
Here's some advice. If the column should have a date or time in it then use a date or time type column. If you are creating a variable data type column then ASAP get a book on SQL before you fuck things up worse then you have.
There is no great mystery here. There is the right way (as suggested by WorkForFood) and there is the wrong way (whatever you are doing). So do what WorkForFood told you or just go away because nobody cares to help make a disaster. -
Generate numbers in incremental order, the number of times condition met?
I have tried explaining my problem here also.
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=31&t=007531&p=1
But trying to put in other words now.
I have a NO tag which appears many times in xml. and alwyas have some random numbers displaying.
output looks something similar to this
something......<NO>1</NO>
something......<NO>1</NO>
something......<NO>2</NO>
something......<NO>1</NO>
something......<NO>3</NO>
something......<NO>1</NO>
something......<NO>5</NO>
something......<NO>1</NO>
something......<NO>1</NO>
something...... & so on.
Now instead of these numbers coming in this order i prefer to display in final output file as
1 2 3 4 5 .................... n
Is it possible in any ways using xslt.
DO we need to ignore the values given in input file and then generate output values for same.
it can be like the number of times NO tag appears in xml, it should start from 1 and keep increasing value by 1, until NO tag finishes appearance.
But next time when other xml transforms it again should be able to start from 1 till n.
is there a possibility of using java code for this situation or xslt is capaable enough to handle this.
Thanks
VJI'm guessing you are looking for something like this. I used a pull approach but it could be done with a push (xsl:for-each).
Sample XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
<NO>1</NO>
<NO>1</NO>
<NO>2</NO>
<NO>1</NO>
<NO>3</NO>
<NO>1</NO>
<NO>5</NO>
<NO>1</NO>
<NO>1</NO>
</root>
Sample XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
<xsl:template match="root">
<output>
<xsl:apply-templates select="NO"/>
</output>
</xsl:template>
<xsl:template match="NO">
<row>
<xsl:value-of select="position()"/>
</row>
</xsl:template>
</xsl:stylesheet>
Sample Output
<output>
<row>1</row>
<row>2</row>
<row>3</row>
<row>4</row>
<row>5</row>
<row>6</row>
<row>7</row>
<row>8</row>
<row>9</row>
</output> -
Number of times an Item of Stock has been Received (Goods Receipt PO)?
Hi Everyone,
I have been asked to create a report to show how often a stock item has been received amongst other details; such as the last Goods Receipt Purchase Order #, and date!
Here is the query that I have created; it is doing everything except returning the number of times that a given Item Code has been received (which is the most important part!)
SELECT
T0.ItemCode AS 'Item Code'
, T0.Dscription AS 'Description'
, MAX(T1.DocNum) AS 'Last Goods Receipt PO #'
, MAX(T1.DocDate) AS 'Last Receipt Date'
, SUM(T0.Quantity) AS 'Received since Go Live!'
, T2.OnHand AS 'Currently On Hand'
, SUM(T1.DocNum) AS '# of Times Received' --Number of Goods Receipt Purchase Orders for the given ItemCode
FROM AU.dbo.PDN1 T0
INNER JOIN AU.dbo.OPDN T1 ON T1.DocEntry = T0.DocEntry
INNER JOIN AU.dbo.OITM T2 ON T2.ItemCode = T0.ItemCode
GROUP BY T0.ItemCode, T0.Dscription, T2.OnHand
ORDER BY T0.ItemCode
The line SUM(T1.DocNum) AS '# of Times Received' is actually returning the SUM of all Document Numbers associated with a given Item Code, whereas I really just want to know how many times a given Item has been received! For example if there are 12 Goods Receipt Purchase Orders for Item 'X' then I simply want to show 12, rather than some obscenely big (meaningless) number.
Any help here will be greatly appreciated.
Kind Regards,
Davidhi,
use below query
SELECT
T0.ItemCode AS 'Item Code'
, T0.Dscription AS 'Description'
, MAX(T1.DocNum) AS 'Last Goods Receipt PO #'
, MAX(T1.DocDate) AS 'Last Receipt Date'
, SUM(T0.Quantity) AS 'Received since Go Live!'
, T2.OnHand AS 'Currently On Hand'
, count (distinct T1.DocNum) AS '# of Times Received'
FROM PDN1 T0
INNER JOIN OPDN T1 ON T1.DocEntry = T0.DocEntry
INNER JOIN OITM T2 ON T2.ItemCode = T0.ItemCode
GROUP BY T0.ItemCode, T0.Dscription, T2.OnHand
ORDER BY T0.ItemCode
regards,
Raviraj -
Displaying different sheets at run time based on value of the parameter
Hi,
I've a query regarding displaying two different sheets at run time in Oracle discoverer based on the value of the parameter that i give.
I've a parameter Summary_flag.
If the value of the parameter is 'Y',then it should display a sheet,say for example it should display Sheet1.
If the value is 'N',then it should display another sheet, say for example it should display Sheet2.
Is there any way in which i can accomplish this?
I went through the Format and Tools menus but couldnt find anything regarding this aspect.
Can you help me out?
Thanks,Having a Disco parameter dictate which worksheet is displayed is not an option that is available. There are a few workarounds, though:
1. Have a portlet (or some other web interface) accept your parameters, and then call the appropriate worksheet.
2. Have 2 worksheets, and have it devolve into a training issue (for a summary run this, for all the details run this).
3. Create calculations that will show or hide column data depending on the parameter selected - the columns will still be there, and you can fill them in with blanks, or a message like "N/A for Summary".
4. Create a report that will allow the users to drill between the summary and detail data - I'm not sure whether you could use a parameter to then say whether the report should open up summarized or expanded. -
G/L Account Display with Vendor Number and Name -Urgent-
Hi Experts!
Is there a transaction, report, or table that can show a list of all the vendor names/numbers for transactions posted to a specific G/L account for a specified period? If so, please let me know. Thank you for your time!
Best Regards,
WCWe can display the Vendor number from the layout in FBL3N report, but the Vendor number will be displayed only if the document is posted from MM module. If the posting is from normal FI, it will not be displayed.
Other option is to develop a simple ABAP report to display Vendor.
Thanks
Murali.
Maybe you are looking for
-
Hi I will really apreciate your help. I have try all I have seen posted. 1) unistal/install again imove 2) Verify and Restore all disk permitions. 3) I dont Have the 3ivx file. only the 2 files that should be in the quicktime folder. 4) I have move.
-
How can i insert more clob objects into oracle9i?
my env: os: windows server 2003 ent sp2 php:=5.2.3 oracle : 9.0.0.8 i look at this article : http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_lobs.html but ,i want insert two clob into the oracle .... Inserting a LOB To INSERT
-
Trouble with while loop, not sure what to put in it in my project
I'm making a class to a simple command line craps game. I must use a while loop to implement craps rules. The rules that i was given are: if your first roll is a 4, 5, 6, 8, 9, or 10, you roll again until either you get a 7 (you lose) or you get the
-
Was doing a drag & drop from iphoto 11, now I cannot launch the app. Iphoto shows up in menu bar but cannot access anything. help!!!
-
I Get 'VI_ERROR_INV_OBJECT'
Hello I try to understand Example 10-1 Page 10-6 in the NI-VISA User Manual All what I do I status = viOpenDefaultRM(&defaultRM); status = viClose (defaultRM); I got, when I Close the Handle 'VI_ERROR_INV_OBJECT' If I do the whole Example I got a acc