Excessive flashback log generates with select statement
Hi everyone;
We have some extractions taken from a "flashback on" database.
Extractions are just select statements but when they are run, database produces excessive flashback logs.
What may be the reason database produce flashback logs with just select statements?
(It's certain that there are no insert-update-delete operations)
Version: 10.2.0.4.3
Thanks...
Do you do heavy update/delete before you select the statements ?
I am not very sure if delayed block cleanout also have the same effect on flashback logs but the output below is leading me to think that way
HR@ORACOS> select * from v$flashback_database_stat;
BEGIN_TIME END_TIME FLASHBACK_DATA DB_DATA REDO_DATA ESTIMATED_FLASHBACK_SIZE
20100527 15:32:53 20100527 15:50:16 875266048 1207132160 2038729728 0
20100527 14:32:50 20100527 15:32:53 248160256 127295488 450139648 1.3215E+10
20100527 13:32:48 20100527 14:32:50 10452992 15646720 4400640 1.5549E+10
20100527 12:32:43 20100527 13:32:48 745693184 948461568 1311620608 2.2789E+10
20100527 11:25:56 20100527 12:32:43 1262026752 1984741376 2358546432 2.7212E+10
HR@ORACOS> set autotrace traceonly statistics
HR@ORACOS> update base_table_np set y='INVALID';
commit;
4021808 rows updated.
Statistics
2512 recursive calls
8341430 db block gets
4069140 consistent gets
120569 physical reads
1908471980 redo size
848 bytes sent via SQL*Net to client
793 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
4021808 rows processed
HR@ORACOS> set autotrace off;
HR@ORACOS> select * from v$flashback_database_stat;
HR@ORACOS>
BEGIN_TIME END_TIME FLASHBACK_DATA DB_DATA REDO_DATA ESTIMATED_FLASHBACK_SIZE
20100527 15:32:53 20100527 16:00:36 1236664320 2021974016 4019910656 0
20100527 14:32:50 20100527 15:32:53 248160256 127295488 450139648 1.3215E+10
20100527 13:32:48 20100527 14:32:50 10452992 15646720 4400640 1.5549E+10
20100527 12:32:43 20100527 13:32:48 745693184 948461568 1311620608 2.2789E+10
20100527 11:25:56 20100527 12:32:43 1262026752 1984741376 2358546432 2.7212E+10
HR@ORACOS> set autotrace traceonly statistics
HR@ORACOS> select * from base_table_np;
4021808 rows selected.
Statistics
139 recursive calls
0 db block gets
53908 consistent gets
4404 physical reads
1652384 redo size ------->delayed block cleanout effect
175008833 bytes sent via SQL*Net to client
88996 bytes received via SQL*Net from client
8045 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
4021808 rows processed
HR@ORACOS> set autotrace off
HR@ORACOS> select * from v$flashback_database_stat; ----flashback data size increases
HR@ORACOS>
BEGIN_TIME END_TIME FLASHBACK_DATA DB_DATA REDO_DATA ESTIMATED_FLASHBACK_SIZE
20100527 15:32:53 20100527 16:01:11 1305264128 2054594560 4021728256 0
20100527 14:32:50 20100527 15:32:53 248160256 127295488 450139648 1.3215E+10
20100527 13:32:48 20100527 14:32:50 10452992 15646720 4400640 1.5549E+10
20100527 12:32:43 20100527 13:32:48 745693184 948461568 1311620608 2.2789E+10
20100527 11:25:56 20100527 12:32:43 1262026752 1984741376 2358546432 2.7212E+10Basically what I do is I update a 4 million table big redo generated with flashback logs
When I do select after the update I still see the redo generated because of delayed block cleanout but what I also see is the slight increase in flashback data size (check the first row of flashback_database_stat) which suits what you asking for. Select statement generates flashback log
Tested on 11.2.0.1 with single active session on the db
Coskan Gundogar
Blog: http://coskan.wordpress.com
Twitter: http://www.twitter.com/coskan
Linkedin: http://uk.linkedin.com/in/coskan
---------
Similar Messages
-
Generating SQL SELECT statement with Schema
I develop a 3rd-party application that connects to various
databases via ODBC. Our program generates the SQL statement
so that the user does not have to. When connecting to oracle the
user often gets the error message: ORA-00942: table or view does
not exist.
To work around this our tech support department has tells the
customer to enter in the Schema name before the table name.
Thus,
SELECT ItemNo from Item
becomes
SELECT ItemNo from MySchema.Item
Is there a way that I can query the Data Source to find out
the Schema name so that our program can put in in the
statement. Is there a SQLGetInfo call I can make to get
this information?
Or, should I have the Server specified in the connection
string? For SQL Server we use SQLGetPrivateProfileString to
obtain the server name and then include it in the connection
string: SRVR=<servername>
Unfortunately, if this is the case the keyword is different
depending on the ODBC Driver involved. "Server" for Microsoft.
"SRVR" for Intersolv. "ServerName" for Oracle.
Note: We do not have Oracle in-house to test with. I'm
wondering if we could get Oracle for free for development
purposes.
Any and all information would be greatly appreciated.Thanks for the tip. I just finished downloading Oracle.
One user is able to successfully view the database with the
statement:
SELECT ItemNo from Item
But if another user tries it he gets the "table or view not
found" message. Changing the statement as follows will allow
the 2nd user to view the database:
SELECT ItemNo from "MAXIMO".Item
I want my application to query the database via ODBC for the
"MAXIMO" string so I can create the correct SQL statement.
Thanks!
<<Are you trying to view tables from a non-default schema?>>I don't know. You would know better than me from my
description. -
Problem with Select Statements
Hi All,
I have a performance problem for my report because of the following statements.
How can i modify the select statements for improving the performance of the report.
DATA : shkzg1h LIKE bsad-shkzg,
shkzg1s LIKE bsad-shkzg,
shkzg2h LIKE bsad-shkzg,
shkzg2s LIKE bsad-shkzg,
shkzg1hu LIKE bsad-shkzg,
shkzg1su LIKE bsad-shkzg,
shkzg2hu LIKE bsad-shkzg,
shkzg2su LIKE bsad-shkzg,
kopbal1s LIKE bsad-dmbtr,
kopbal2s LIKE bsad-dmbtr,
kopbal1h LIKE bsad-dmbtr,
kopbal2h LIKE bsad-dmbtr,
kopbal1su LIKE bsad-dmbtr,
kopbal2su LIKE bsad-dmbtr,
kopbal1hu LIKE bsad-dmbtr,
kopbal2hu LIKE bsad-dmbtr.
*These statements are in LOOP.
SELECT shkzg SUM( dmbtr )
INTO (shkzg1s , kopbal1s)
FROM bsid
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'S'
AND umskz EQ ''
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg1su , kopbal1su)
FROM bsid
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'S'
AND umskz IN zspgl
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg1h , kopbal1h)
FROM bsid
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'H'
AND umskz EQ ''
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg1hu , kopbal1hu)
FROM bsid
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'H'
AND umskz IN zspgl
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg2s , kopbal2s)
FROM bsad
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'S'
AND umskz EQ ''
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg2su , kopbal2su)
FROM bsad
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'S'
AND umskz IN zspgl
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg2h , kopbal2h)
FROM bsad
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'H'
AND umskz EQ ''
GROUP BY shkzg.
ENDSELECT.
SELECT shkzg SUM( dmbtr )
INTO (shkzg2hu , kopbal2hu)
FROM bsad
WHERE bukrs = ibukrs
AND kunnr = ktab-kunnr
AND budat < idate-low
AND shkzg = 'H'
AND umskz IN zspgl
GROUP BY shkzg.
ENDSELECT.>
Siegfried Boes wrote:
> Please stop writing answers if you understrand nothing about database SELECTS!
> All above recommendations are pure nonsense!
>
> As always with such questions, you must do an analysis before you ask! The coding itself is perfectly o.k., a SELECT with an aggregate and a GROUP BY can not be changed into a SELECT SINGLE or whatever.
>
> But your SELECTS mustr be supported by indexes!
>
> Please run SQL Trace, and tell us the results:
>
> I see 8 statements, what is the duration and the number of records coming back for each statement?
> Maybe only one statement is slow.
>
> See
> SQL trace:
> /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
>
>
> Siegfried
Nice point there Siegfried. Instead of giving constructive suggestion, people here give a very bad suggestion on using SELECT SINGLE combined with SUM and GROUP BY.
I hope the person already look at your reply before he try using select single and wondering why he has error.
Anyway, the most important thing is how many loop expected for those select statements?
If you have like thousands of loop, you can expect a poor performance.
So, you should also look at how many times the select statement is called and not only performance for each select statement when you're doing SQL trace.
Regards,
Abraham -
Problem with Select statement.
DATA: wa_usr05 TYPE usr05.
The select statement always gives sy-subrc = 0
even if there is no entry with parid = 'ZRD'.
On successful it fills the structure wa_usr05 as
MANDT C 3 ACC
BNAME C 12 SCL
PARID C 20 X
PARVA C 18
but mandt is 310.
USR05 is a pool table and has mandt field.
SELECT SINGLE bname
parid
parva
FROM usr05
INTO wa_usr05
WHERE bname = sy-uname AND
parid = 'ZRD' AND
parva = 'x' OR parva = 'X'.
Let me know the reason and solution to the problem.SELECT SINGLE * FROM usr05
INTO wa_usr05
WHERE bname = sy-uname AND
parid = 'ZRD' AND
parva = <b>'X'</b> .
Use single * as u have defined the wa+usr05 as usr05.
Else.
DATA: i_usr05 TYPE STANDARD TABLE of usr05.
SELECT * FROM USR05
INTO TABLE usr05
WHERE bname = sy-uname AND
parid = 'ZRD' AND
parva = <b>'X'</b> .
Then loop at itab and write data.
Hope this solves ur query.
Reward points if this helps.
Message was edited by:
Judith Jessie Selvi -
Problem with SELECT statement. What is wrong with it?
Why is this query....
<cfquery datasource="manna_premier" name="kit_report">
SELECT Orders.ID,
SaleDate,
Orders.UserID,
Distributor,
DealerID,
Variable,
TerritoryManager,
US_Dealers.ID,
DealerName,
DealerAddress,
DealerCity,
DealerState,
DealerZIPCode,
(SELECT SUM(Quantity)
FROM ProductOrders PO
WHERE PO.OrderID = Orders.ID) as totalProducts,
FROM Orders, US_Dealers
WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)# AND Variable = '#Variable#'
</cfquery>
giving me this error message...
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
The error occurred in D:\Inetpub\mannapremier\kit_report2.cfm: line 20
18 : WHERE PO.OrderID = Orders.ID) as totalProducts,
19 : FROM Orders, US_Dealers
20 : WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)# AND Variable = '#Variable#'
21 : </cfquery>
22 :
SQLSTATE
42000
SQL
SELECT Orders.ID, SaleDate, Orders.UserID, Distributor, DealerID, Variable, TerritoryManager, US_Dealers.ID, DealerName, DealerAddress, DealerCity, DealerState, DealerZIPCode, (SELECT SUM(Quantity) FROM ProductOrders PO WHERE PO.OrderID = Orders.ID) as totalProducts, FROM Orders, US_Dealers WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN {d '2009-10-01'} AND {d '2009-10-31'} AND Variable = 'Chick Days pre-book'
VENDORERRORCODE
-3504
DATASOURCE
manna_premier
Resources:
I copied it from a different template where it works without error...
<cfquery name="qZVPData" datasource="manna_premier">
SELECT UserID,
TMName,
UserZone,
(SELECT COUNT(*)
FROM Sales_Calls
WHERE Sales_Calls.UserID = u.UserID) as totalCalls,
(SELECT COUNT(*)
FROM Orders
WHERE Orders.UserID = u.UserID) as totalOrders,
(SELECT SUM(Quantity)
FROM ProductOrders PO
WHERE PO.UserID = u.UserID AND PO.NewExisting = 1) as newItems,
(SELECT SUM(NewExisting)
FROM ProductOrders PO_
WHERE PO_.UserID = u.UserID) as totalNew,
SUM(totalOrders)/(totalCalls) AS closePerc
FROM Users u
WHERE UserZone = 'Central'
GROUP BY UserZone, UserID, TMName
</cfquery>
What is the problem?It's hard to say: what's your request timeout set to?
700-odd records is not much of a fetch for a decent DB, and I would not expect that to case the problem. But then you're using Access which doesn't fit the description of "decent DB" (or "fit for purpose" or "intended for purpose"), so I guess all bets are off one that one. If this query is slow when ONE request is asking for it, what is going to happen when it goes live and multiple requests are asking for it, along with all the other queries your site will want to run? Access is not designed for this. It will really struggle, and cause your site to run like a dog. One that died serveral weeks ago.
What else is on the template? I presume you're doing something with the query once you fetch it, so could it be that code that's running slowly? Have you taken any steps to isolate which part of the code is taking so long?
How does the query perform if you take the subquery out of the select line? Is there any other way of getting that data? What subquery will be running once for every row of the result set... not very nice.
Adam -
SQL insert with select statement having strange results
So I have the below sql (edited a bit). Now here's the problem.
I can run the select statement just fine, i get 48 rows back. When I run with the insert statement, a total of 9062 rows are inserted. What gives?
<SQL>
INSERT INTO mars_aes_data
(rpt_id, shpdt, blno, stt, shpr_nad, branch_tableS, csgn_nad,
csgnnm1, foreign_code, pnt_des, des, eccn_no, entity_no,
odtc_cert_ind, dep_date, equipment_no, haz_flag, schd_no,
schd_desc, rec_value, iso_ulti_dest, odtc_exempt, itn,
liscence_no, liscence_flag, liscence_code, mblno, mot,
cntry_load, pnt_load, origin_state, airline_prefix, qty1, qty2,
ref_val, related, routed_flag, scac, odtc_indicator, seal_no,
line_no, port_export, port_unlading, shipnum, shprnm1, veh_title,
total_value, odtc_cat_code, unit1, unit2)
SELECT 49, schemaP.tableS.shpdt, schemaP.tableS.blno,
schemaP.tableS.stt, schemaP.tableS.shpr_nad,
schemaP.tableM.branch_tableS, schemaP.tableS.csgn_nad,
schemaP.tableS.csgnnm1, schemaP.tableD.foreign_code,
schemaP.tableS.pnt_des, schemaP.tableS.des,
schemaP.tableD.eccn_no, schemaP.tableN.entity_no,
schemaP.tableD.odtc_cert_ind, schemaP.tableM.dep_date,
schemaP.tableM.equipment_no, schemaP.tableM.haz_flag,
schemaP.tableD.schd_no, schemaP.tableD.schd_desc,
schemaP.tableD.rec_value,
schemaP.tableM.iso_ulti_dest,
schemaP.tableD.odtc_exempt, schemaP.tableM.itn,
schemaP.tableD.liscence_no,
schemaP.tableM.liscence_flag,
schemaP.tableD.liscence_code, schemaP.tableS.mblno,
schemaP.tableM.mot, schemaP.tableS.cntry_load,
schemaP.tableS.pnt_load, schemaP.tableM.origin_state,
schemaP.tableM.airline_prefix, schemaP.tableD.qty1,
schemaP.tableD.qty2,
schemaC.func_getRefs@link (schemaP.tableS.ptt, 'ZYX'),
schemaP.tableM.related, schemaP.tableM.routed_flag,
schemaP.tableM.scac, schemaP.tableD.odtc_indicator,
schemaP.tableM.seal_no, schemaP.tableD.line_no,
schemaP.tableM.port_export,
schemaP.tableM.port_unlading, schemaP.tableS.shipnum,
schemaP.tableS.shprnm1, schemaP.tableV.veh_title,
schemaP.tableM.total_value,
schemaP.tableD.odtc_cat_code, schemaP.tableD.unit1,
schemaP.tableD.unit2
FROM schemaP.tableD@link,
schemaP.tableM@link,
schemaP.tableN@link,
schemaP.tableS@link,
schemaP.tableV@link
WHERE tableM.answer IN ('123', '456')
AND SUBSTR (tableS.area, 1, 1) IN ('A', 'S')
AND entity_no IN
('A',
'B',
'C',
'D',
'E',
AND TO_DATE (SUBSTR (tableM.time_stamp, 1, 8), 'YYYYMMDD')
BETWEEN '01-Mar-2009'
AND '31-Mar-2009'
AND tableN.shipment= tableD.shipment(+)
AND tableN.shipment= tableS.shipnum
AND tableN.shipment= tableM.shipment(+)
AND tableN.shipment= tableV.shipment(+)
<SQL>
Edited by: user11263048 on Jun 12, 2009 7:23 AM
Edited by: user11263048 on Jun 12, 2009 7:27 AMCan you change this:
BETWEEN '01-Mar-2009'
AND '31-Mar-2009'To this:
BETWEEN TO_DATE('01-Mar-2009', 'DD-MON-YYYY')
AND TO_DATE('31-Mar-2009','DD-MON-YYYY')That may make no difference but you should never rely on implicit conversions like that, they're always likely to cause you nasty surprises.
If you're still getting the discrepancy, instead of and INSERT-SELECT, can you try a CREATE TABLE AS SELECT... just to see if you get the same result. -
Problem with select statement using Ranges
Hi Guys,
I have used Ranges and used a select statement for selecting those ranges but I am facing a problem.
RANGES: r_doctyp for EDIDC-DOCTYP.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'DEBMAS'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'MATMAS'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'PRICAT'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'ORDERS'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'INVOIC'.
append r_doctyp.
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT EQ s_credat-low
and DOCTYP EQ r_doctyp " IDOC Types
and DIRECT EQ '1'.
Here my select statement is only taking INVOIC.
But my statement should take any document type.
Thanks,
Prasad.Hi...,
Your following select statement is correct.
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT IN s_credat
and DOCTYP IN r_doctyp " IDOC Types
and DIRECT EQ '1'.
Why you are not getting result..
1. structure of the IT_ZEDIDC is having two fields DOCNUM , DOCTYP with same data lengths. If not it should be...
2. Order in the database table is must be similer to the order you maintained in the select statement.
3. As you are hard coding the input ranges make sure about every letter.
4. take a look at other where condition fields too.
5. check the table of the ranges in debugging mode.
6. why can't you declare separate work area and table for ranges...?
like .... data: r_tab type range of <field>
data: wa_tab like line of r_tab.
7. Use clear work area statement after the append statment.
--Naveen Inuganti. -
Hi All,
I am getting the error 'Comma without preceding colon (after SELECT ?).' with the following select statement. Can someone help me with the error.
select single actdate_from actdate_to
into ( lv_actdate_from, lv_actdate_to )
from zsdcoop
where kunnr = wa-kunnr and pfnum = wa-pfnum.
if ( lv_actdate_from NE wa-actdate_from ) or ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'.
Endif.
Thanks,
Veni.Typically, on statements like this, you want to use AND instead of OR. Google "truth tables" for a detailed explanation of why.
if ( lv_actdate_from NE wa-actdate_from ) or ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'.
Should probably be:
if ( lv_actdate_from NE wa-actdate_from ) AND ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'. -
Need help with select statement or query
Not familiar with what to call it, but here is what i need...
To give our analyst a better idea of warranty on some of our
equipment, i
would like to add to the page a column that displays if the
device is still
under warranty
I currently capture the date the equipment was returned from
repair, so what
could i use within my select statement or query to display a
warranty
expiration date or display on the page...
example :
Returned from repair 10/20/2006 warranty expires on
11/20/2006
each equipment has different warranties, so i need a formula
or something to
say... device #1 has 60 day warranty ( so 10/20/2006 + 60days
=
12/19/2006 )
I would imagine this to be a query
Table 1 would contain the equipment type and warranty time
Table 2 would contain the current status of the equipment
Query would take the back from repair date + warranty =
expiration dateSimple. Join the two tables and create a derived column for
the expiration date. The exact syntax is dependant on your DBMS, so
check the manual for whichever you are using and look at the date
functions. There will be a function that will allow you to add a
number of date units (day, month, year, etc) to a date
field. -
Creating a Job for publication in Sql Server with select statement for passing a parameter
I am creating a job for adding article to a publication. the second step (e.g. for adding article) gives me error. I pass the name of the table as follow:
EXEC sp_addarticle
@publication = 'TTB', --THE NAME OF MY PUBLICATION
'select top (1)' @article = 'Name from TableAdded Order by create_date Desc',
'select top (1)' @source_object = 'Name from TableAdded Order by create_date Desc',
@force_invalidate_snapshot = 1;
TableAdded is a table I have in my publisher which contains the name of the newly added table.
I believe it fails because the way I pass the name of the article to the store procedure is not correct. Can anyone please help me on that?
Kind regards
AminYes, the way you add article is wrong.
you may try the below and let us know if you have any issues:
while loop begin (Get the values from TableAdded with status IsAdded=0)
Assign the values to variables like @article = Select top 1 Name from TableAdded where IsAdded=0
Call the sp_addarticle assigning the variable
update the Isadded flag in tableAdded for the name to 1
end while
BTB, Article configuration is supposed to be a one time configuration. Having said, you can easily configure through API. Caution, not sure what are you trying here, for adding new article, you may need to synch the data first in the above approach and should
carried out in the downtime. -
I have a publisher 11g (v 11.1.1.7) report with a single parameter. The report is based on a data model not a subject area. I created a dashboard put a dashboard prompt and link to the report in separate section on the same page. The dashboard prompt sets a presentation variable named the same as the parameter in the report.
The problem was when I created the dashboard prompt, it forced me to select a subject area which I did (though did not want to) and then I created both a column and variable prompts. But clicking on the
report link completely ignored the value that I thought would be passed in the presentation variable to the report.
Side note : My report uses a pdf template for its layout where I have mapped the columns names from my data model to the form fields on the pdf form. I noticed that if I create a publisher report based on a subject area, then I do not have the choice to choose a PDF as a template type for my layout. (I only see BI Publisher Template as a choice).
I see some documentation online that suggest it could be done in 10g.
Thanks
M. JamalOk,
I just tried that and it still doesn't pass anything to the prompt.
I changed the prompt to an edit field and I made the following weblink but when i click the link from an account it doesn't put anything in the prompt and all data for all accounts is shown.
This is the URL maybe I messed something up...
https://secure-ausomx###.crmondemand.com/OnDemand/user/Dashboard?OMTHD=ShowDashboard&OMTGT=ReportIFrame&SelDashboardFrm.Dashboard Type=%2fshared%2fCompany_########_Shared_Folder%2f_portal%2f360+Report&Option=rfd&Action=Navigate&P0=1&P1=eq&P2=Account."Account Name"&P3=%%%Name%%%
thanks -
Problems with select statement
Hi,
For some reason I cannot find the solution for the following problem.
I have an internal table.
Now I like to make an select over a database table, while only rows should be selected, where the key field occurs in the internal table and in case of identical key field only the row with the lowest value in another column is selcted.
Example:
- internal table:
col1 col2 col3
1 A AA
2 B AA
3 A AC
-database table:
col1 col2 col3
1 001 CD
1 002 CF
1 003 CG
2 001 CD
2 002 CF
2 003 CG
3 002 CF
3 003 CG
4 001 CD
4 002 CF
4 003 CG
- the selected database entries should be
1 001 CD
2 001 CD
3 002 CF
explication:
- entries with 4 in the first column do not occur in the internal table, so they do not appear in the selection
- in case of more than one entry in the database table only the one with the lowest value in column two will be selected
If you have any idea how this could be solved, I would really appreciate you help.
regards
TorstenHi,
1) u have to select based on internal table 1
2) u have to filter the internal table 2 for minimum value.
select col1 col2 col3
from <any table>
into table <Internal_table_final>
for all entries in <Internal_table_1>
where col1 = Internal_table_1-col1.
sort Internal_table_final by col1 col2.
loop at Internal_table_final.
at new col1.
continue.
endat.
delete Internal_table_final.
endloop.
<b>try this</b>
Regards
<b>Mark Helpful Answers</b>
Message was edited by: Manoj Gupta -
Hello,
My table looks similar to this, I have removed a few columns:
table1:
Forecast_id Forecast_name Freeze Enabled
100 Q12009 N Y
101 Q22009 N Y
table2:
forecast_id parameter_name parameter_value
100 StartDate 01/01/2009
100 EndDate 03/31/2009
100 Growth % 20
100 Retailer Walmart
101 StartDate 04/01/2009
101 EndDate 06/30/2009
101 Growth % 20
101 Retailer Walmart
What i need to do is
select from table 1, forecast name & freeze
where in table2 parameter = Retailer, Parameter value = Walmart and
Start Date = 01/01/2009 and End Date = 03/31/2009
here is my query is there a easy way this can be done. I have used decode function in the past for similar situation for counting and grouping.
SELECT i.FORECAST_ID,
i.FORECAST_NAME,
i.FREEZE_FLAG
FROM (
SELECT x.FORECAST_ID,
x.FORECAST_NAME,
x.FREEZE_FLAG
FROM (
SELECT A.FORECAST_ID,
A.FORECAST_NAME,
A.FREEZE_FLAG
FROM GC_FORECAST A, GC_FORECAST_PARAMETERS B
WHERE A.FORECAST_ID = B.FORECAST_ID
AND B.PARAMETER_NAME = 'Retailer'
AND B.PARAMETER_VALUE = 'Walmart'
) x, GC_FORECAST_PARAMETERS y
WHERE x.FORECAST_ID = y.FORECAST_ID
AND y.PARAMETER_NAME = 'StartDate'
AND y.PARAMETER_VALUE = '01/01/2009'
) i, GC_FORECAST_PARAMETERS j
WHERE i.FORECAST_ID = j.FORECAST_ID
AND j.PARAMETER_NAME = 'EndDate'
AND j.PARAMETER_VALUE = '03/31/2009';
Thank you for your time and help.
Vidhya
Edited by: snaraya9 on Dec 5, 2008 12:03 PM
Edited by: snaraya9 on Dec 5, 2008 12:06 PMSolution
SELECT gc_forecast.forecast_id, gc_forecast.forecast_name, gc_forecast.freeze,
gc_forecast.enabled
FROM gc_forecast,
(SELECT forecast_id,
MAX (CASE
WHEN parameter_name = 'StartDate'
AND parameter_value = '01/01/2009'
THEN 1
ELSE 0
END
) cond1,
MAX (CASE
WHEN parameter_name = 'EndDate'
AND parameter_value = '03/31/2009'
THEN 1
ELSE 0
END
) cond2,
MAX (CASE
WHEN parameter_name = 'Retailer'
AND parameter_value = 'Walmart'
THEN 1
ELSE 0
END
) cond3
FROM gc_forecast_parameters
GROUP BY forecast_id) gf
WHERE gc_forecast.forecast_id = gf.forecast_id
AND gf.cond1 = 1
AND gf.cond2 = 1
AND gf.cond3 = 1
Demo
SQL*Plus: Release 10.1.0.4.2 - Production on Ven. Déc. 5 15:34:14 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connecté à :
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> /* Formatted on 2008/12/05 15:33 (Formatter Plus v4.8.8) */
SQL> WITH gc_forecast_parameters AS
2 (SELECT 100 forecast_id, 'StartDate' parameter_name,
3 '01/01/2009' parameter_value
4 FROM DUAL
5 UNION ALL
6 SELECT 100, 'EndDate', '03/31/2009'
7 FROM DUAL
8 UNION ALL
9 SELECT 100, 'Growth', '% 20'
10 FROM DUAL
11 UNION ALL
12 SELECT 100, 'Retailer', 'Walmart'
13 FROM DUAL
14 UNION ALL
15 SELECT 101, 'StartDate', '04/01/2009'
16 FROM DUAL
17 UNION ALL
18 SELECT 101, 'EndDate', '06/30/2009'
19 FROM DUAL
20 UNION ALL
21 SELECT 101, 'Growth', '% 20'
22 FROM DUAL
23 UNION ALL
24 SELECT 101, 'Retailer', 'Walmart'
25 FROM DUAL),
26 gc_forecast AS
27 (SELECT 100 forecast_id, 'Q12009' forecast_name, 'N' freeze, 'Y' enabled
28 FROM DUAL
29 UNION ALL
30 SELECT 101, 'Q22009', 'N', 'Y'
31 FROM DUAL)
32 SELECT gc_forecast.forecast_id, gc_forecast.forecast_name, gc_forecast.freeze,
33 gc_forecast.enabled
34 FROM gc_forecast,
35 (SELECT forecast_id,
36 MAX (CASE
37 WHEN parameter_name = 'StartDate'
38 AND parameter_value = '01/01/2009'
39 THEN 1
40 ELSE 0
41 END
42 ) cond1,
43 MAX (CASE
44 WHEN parameter_name = 'EndDate'
45 AND parameter_value = '03/31/2009'
46 THEN 1
47 ELSE 0
48 END
49 ) cond2,
50 MAX (CASE
51 WHEN parameter_name = 'Retailer'
52 AND parameter_value = 'Walmart'
53 THEN 1
54 ELSE 0
55 END
56 ) cond3
57 FROM gc_forecast_parameters
58 GROUP BY forecast_id) gf
59 WHERE gc_forecast.forecast_id = gf.forecast_id
60 AND gf.cond1 = 1
61 AND gf.cond2 = 1
62 AND gf.cond3 = 1;
FORECAST_ID FORECA F E
100 Q12009 N Y
SQL> -
Need Hello with select statement
Hi Experts ,
I How can i select all record in where MATNR starl with 1 or 2 or 3 (if there is zero it should not be consider ) I can not use
c_webaz TYPE i.
SELECT rsnum
rspos
rsart
matnr
werks
lgort
charg
bdter
bdmng
meins
enmng
bwart
INTO TABLE gt_resb
FROM resb
WHERE xloek EQ 'X'
AND xwaok EQ space
AND kzear EQ space
AND bwart IN ('201','261','221') .
AND MATNR LIKE '1%'
because if leading zero there it not selection this recode .
Waiting for reply.you can build a range like the sample below and use that in select
MOVE 'I' TO ra_labor-sign.
MOVE 'EQ' TO ra_labor-option.
MOVE c_02 TO ra_labor-low.
APPEND ra_labor.
* CLEAR ra_labor.
MOVE c_21 TO ra_labor-low.
APPEND ra_labor.
* CLEAR ra_labor.
MOVE c_31 TO ra_labor-low. " added
APPEND ra_labor.
CLEAR ra_labor.
SELECT rsnum rspos rsart matnr werks lgort charg bdter bdmng
meins enmng bwart
INTO TABLE gt_resb
FROM resb
WHERE xloek EQ 'X'
AND xwaok EQ space
AND kzear EQ space
AND bwart IN ('201','261','221') .
AND MATNR in ra_matnr "<<< range you created above -
Strange results with Insert statement having select query
Hi all,
I am facing a strange issue with Insert statement based on a select query having multiple joins.
DB- Oracle 10g
Following is the layout of my query -
Insert into Table X
Select distinct Col1, Col2, Col3, Col4, Function(Col 5) from Table A, B
where trunc(updated_date) > = trunc(sysdate-3)
and join conditions for A, B
Union
Select Col1, Col2, Col3, Col4, Function(Col 5) from Table C, D
trunc(updated_date) > = trunc(sysdate-3)
and join conditions for C, D
Union
.... till 4 unions. all tables are residing in the local Database and not having records more than 50,000.
If I execute above insert in a DBMS job, it results into suppose 50 records where as if I execute the select query it gives 56 records.
We observed following things-
a) no issue with size of tablespace
b) no error while inserting
c) since query takes lot of time so we have not used Cursor and PLSQL block for inserting.
d) this discrepancy in number of records happens frequently but not everytime.
e) examined the records left out from the insert, there we couldn't find any specific pattern.
f) there is no constraint on the table X in which we are trying to insert. Also tables A, B, C....
I went through this thread -SQL insert with select statement having strange results but mainly users are having either DB Links or comparison of literal dates, in my case there is none.
Can somebody explain why is the discrepancy and what is the solution for it.
Or atleast some pointers how to proceed with the analysis.
Edited by: Pramod Verma on Mar 5, 2013 4:59 AM
Updated query and added more details>
Since I am using Trunc() in the where clause so timing should not matter much. Also I manually ruled out records which were updated after the job run.
>
The first rule of troubleshooting is to not let your personal opinion get in the way of finding out what is wrong.
Actually this code, and the process it represents, is the most likely CAUSE of the problem.
>
where trunc(updated_date) > = trunc(sysdate-3)
>
You CANNOT reliably use columns like UPDATED_DATE to select records for processing. Your process is flawed.
The value of that column is NOT the date/time that the data was actually committed; it is the date/time that the row was populated.
If you insert a row into a table right now, using SYSDATE (8am on 3/5/2013) and don't commit that row until April your process will NEVER see that 3/5/2013 date until April.
Here is the more typical scenario that I see all the time.
1. Data is inserted/updated all day long on 3/4/2013.
2. A column, for example UPDATED_DATE is given a value of SYSDATE (3/4/2013) in a query or by a trigger on the table.
3. The insert/update query takes place at 11:55 PM - so the SYSDATE values are for THE DAY THE QUERY BEGAN
4. The data pull begins at 12:05 am (on 3/5/2013 - just after midnight)
5. The transaction is COMMITTED at 12:10 AM (on 3/5/2013); 5 minutes after the data pull began.
That data extract in step 4 will NEVER see those records! They DO NOT EXIST when the data pull query is executed since they haven't been committed.
Even worse, the next nights data pull will not see them either! That is because the next pull will pull data for 3/5/2013 but those records have a date of 3/4/2013. They will never get processed.
>
Job timing is 4am and 10pm EST
>
Another wrinkle is when data is inserted/updated from different timezones and the UPDATED_DATE value is from the CLIENT pc or server. Then you can get even more data missed since the client dates may be hours different than the server date used for the data pull process.
DO NOT try to use UPDATED_DATE type columns to do delta extraction or you can have this issue.
Maybe you are looking for
-
XSD file Created in PI 7.0 is not working in MDM
Hi Experts, Need your help on the below scenario: I have created the data types in in PI 7.0 and exported XSD file but, while connecting to syndicator (by using XML Schema file option) system is giving root element is missg error message. But, if i
-
TS3048 Scrolling problems with PDF documents
Whenever I open a PDF document in my mac, I am unable to use the mouse to scroll, print or close the documents. I do not have any such problems while working with any other documents i.e. MS OFFICE etc. Why is this problem and what could be the sol
-
An additional question about regular expressions with String.matches
does the String.matches() method match expressions when some substring of the String matches, or does it have to match the entire String? So, if i have the String "123ABC", and i ask to match "1 or more letters" will it fail because there are non-let
-
Hi, I need a help. I created a movieclip called ball and added linkage as 'ball' and also checked the option 'export in first frame' it is working fine, BUT if i do like that then exports the movie clip in first frame and it take big time to show pre
-
Can the microsoft office be installed on the iPad2?
can the microsoft office be installed on the iPad2?