Lexical
Hi,
Using where clause in the lexical parameter.
Please explain me with the code.
Thanks & Regards
vijayanand.
what exactly is your question?
Similar Messages
-
EBS 11.5.10.2
XMLP 5.6.3
ARXAGMW.rdf
Hello,
I am trying to convert an Oracle Report to XML Publisher, and I am having problems getting lexicals in the Data Template to work.
I raised an SR for this since both related threads in this forum from two years ago were unresolved. Oracle had no answers for me, and told me to ask the question here.
So anyone who has any ideas, please chime in!
Here is a simplified version of the data template, narrowed down to just the use of the lexicals:
<?xml version="1.0" encoding="utf-8"?>
<dataTemplate name="XXWLC_ARXAGMW"
description="samples from doco"
defaultPackage=""
dataSourceRef="ORA_EBS"
version="1.0">
<properties>
<property name="xml_tag_case" value="upper" />
<property name="include_parameters" value="true" />
<property name="debug_mode" value="on" />
</properties>
<parameters>
<parameter name="P_ID_FLEX_NUM" dataType = "number" defaultValue="101" />
</parameters>
<lexicals>
<lexical type="oracle.apps.fnd.flex.kff.segments_metadata"
name="FLEX_GL_BALANCING_APROMPT"
comment="Comment"
application_short_name="SQLGL"
id_flex_code="GL#"
id_flex_num=":P_ID_FLEX_NUM"
segments="GL_BALANCING"
show_parent_segments="Y"
metadata_type="ABOVE_PROMPT"/>
<lexical type="oracle.apps.fnd.flex.kff.segments_metadata"
name="FLEX_GL_ACCOUNT_LPROMPT"
comment="Comment"
application_short_name="SQLGL"
id_flex_code="GL#"
id_flex_num=":P_ID_FLEX_NUM"
segments="GL_ACCOUNT"
show_parent_segments="Y"
metadata_type="LEFT_PROMPT"/>
<lexical type="oracle.apps.fnd.flex.kff.segments_metadata"
name="ACCT_BAL_LPROMPT"
application_short_name="SQLGL"
id_flex_code="GL#"
id_flex_num=":P_ID_FLEX_NUM"
segments="GL_BALANCING"
show_parent_segments="Y"
metadata_type="LEFT_PROMPT" />
</lexicals>
<dataQuery>
<sqlStatement name="Q_DOCO_SAMPLE">
<![CDATA[
SELECT
&FLEX_GL_BALANCING_APROMPT alias_gl_balancing_aprompt
,&FLEX_GL_ACCOUNT_LPROMPT alias_gl_account_lprompt
,&ACCT_BAL_LPROMPT alias_acct_bal_lprompt
FROM dual
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_DOCO_SAMPLE" dataType="varchar2" source="Q_DOCO_SAMPLE">
<element name="sample_gl_balancing_aprompt" dataType="varchar2" value="alias_gl_balancing_aprompt" />
<element name="sample_gl_account_lprompt" dataType="varchar2" value="alias_gl_account_lprompt" />
<element name="sample_acct_bal_lprompt" dataType="varchar2" value="alias_acct_bal_lprompt" />
</group>
</dataStructure>
</dataTemplate>The lexicals "compile" and run successfully, but they return String values that SHOULD be wrapped with quotes; but this doesn't happen, so the SQL that runs is:
SELECT
COMPANY alias_gl_balancing_aprompt
,ACCT alias_gl_account_lprompt
,CO alias_acct_bal_lprompt
FROM dualThus, the concurrent program ends with ERROR, due to java.sql.SQLException: ORA-00904: "CO": invalid identifier
The first two lexicals and their corresponding sql statement are samples directly from the user guide (which is full of errors). The third lexical is the one from ARXAGMW.rdf.xml that I am trying to make work.
Edited by: user650442 on Apr 30, 2010 3:58 PMBy the way, simply adding the quotes around the lexical names in the sql statement doesn't work. That causes the lexical references to be ignored as simple string values:
SELECT
'&FLEX_GL_BALANCING_APROMPT' alias_gl_balancing_aprompt
,'&FLEX_GL_ACCOUNT_LPROMPT' alias_gl_account_lprompt
,'&ACCT_BAL_LPROMPT' alias_acct_bal_lprompt
FROM dualI turned on statement-level debugging via xdodebug.cfg and saw how it compiled the lexicals. By replicating the call to apps.fnd_flex_xml_publisher_apis.kff_segments_metadata that I found there, I was able to hack together a workaround for this issue.
Please point me to a better way of doing this if possible, as I had to GRANT EXECUTE on this apps package to my custom code schema. Is there a better lexical/flexfields reference than the XML Publisher documentation?
Here is the call I made in my before-report trigger:
--set ACCT_BAL_LPROMPT flexfield segment metadata lexical
begin
apps.fnd_flex_xml_publisher_apis.kff_segments_metadata(
'FLEX_ACCT_BAL_LPROMPT',
'SQLGL',
'GL#',
101,
'GL_BALANCING',
'Y',
'LEFT_PROMPT',
c_FLEX_ACCT_BAL_LPROMPT
end; -
Can we use formula column in lexical parameter in sql query ...
hi
can we use formula column in lexical parameter in sql query ...
as example
i want to give
select * from & c_table
forumula
function c_table
if :p_sort = 1 then
return 'dept'
else
return 'emp'
end;
c_table formula column
is this possible ...
i have such example in oracle apps reports
if i try in ordinary report usinf emp table it show error ..
how we can give formula column...
please help me in this regard...
Edited by: 797525 on Feb 20, 2012 9:31 PMthanks sir,
iam not exactly saying select * from &c_table but some thing that like columns in select stmt also will be populated in user_parameters ,there are lot of table select.......from mtl_demand md, mtl_system_items msi, mtl_txn_source_types mtst, mtl_item_locations loc &C_source_from &C_from_cat
&c_source_from and &c_from_cat formula column and there are defined at report level only ......
pl/sql code &c_source_from is
function C_source_fromFormula return VARCHAR2 is
begin
if :P_source_type_id = 2 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id = 3 then return(',GL_CODE_COMBINATIONS gl');
else if :P_source_type_id = 6 then return(',MTL_GENERIC_DISPOSITIONS mdsp');
else if :P_source_type_id = 5 then
if :C_source_where is null then
return NULL;
else
return(',WIP_ENTITIES wip');
end if;
else if :P_source_type_id = 8 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id is null then
return(',MTL_SALES_ORDERS mkts,
MTL_GENERIC_DISPOSITIONS mdsp,
GL_CODE_COMBINATIONS gl ');
else null;
end if; end if; end if; end if; end if; end if;
RETURN NULL; end;
this is forumula column i hope that you understand what iam saying
please help me in this regard....
thanking you... -
Lexical parameter in select statement showing null or column name in xml tag instead of value
Hi,
i am using lexical parameter in report select statement as
Select &order value from oe_order_headers_all a where order_number ='7889'
and setting : order:='a.order_number'; in after parameter form trigger.
lexical parameter intial value set to null
when i run this report , its not showing order number in output ,its showing null or a.order_number as text.
Please help.try this
Select &order data_show
from oe_order_headers_all
where order_number ='7889'
and setting :order:='order_number'; in after parameter form trigger.
Hope this helps
Hamid -
How to use lexical parameter in report
i want to use lexical parameter in report and pass parameter from form how it is possible in detail
A.RHi,
typically you fill your lexical paramter in the after-paramform-trigger out of the values of your bind-parameters (giving end users directly control over lexical parameters might not be a good idea). Inside PL/SQL a lexical parameter is referenced like bind parameters with ":". In the query it's referenced via "&" and represents a part of the query.
A simple example.
- p_deptno as bind parameter
- p_where as lexical paramter
- end user choose value for p_deptno (10,20,... or nothing)
- Trigger: if :p_deptno is not null then
:p_where := 'WHERE deptno = :p_deptno'
else
:p_where := null;
end if;
- Query select ... from emp &p_where
Regards
Rainer -
Calling report from form with lexical parameter
hi
DECLARE
repid REPORT_OBJECT;
v_rep VARCHAR2(1000);
rep_status VARCHAR2(20);
BEGIN
repid := FIND_REPORT_OBJECT( 'REPORT34' );
set_report_object_property(repid,report_other,'p_SEASON_YEAR='||:SALE_ORDER.SEASON_YEAR
||' &sort='||:sale_order.sort1);
--set_report_object_property(repid,report_other,'p_g_id =20');
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
--Display report in the browser
WEB.SHOW_DOCUMENT('http://127.0.0.1:8889/reports/rwservlet/getjobid'||
substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver90','_blank');
ELSE
message('Error when running report');
END IF;
PAUSE;
END;i had made a lexical parameter in reports the reports code is
SELECT s.season_year,sd.prod_id,P.PROD_NAME,sum(sd.total_qty)
FROM sale_order s,sale_order_detail sd,PRODUCT P,CUSTOMER_MASTER cm,CUSTOMER_DETAIL cd
where s.id=sd.id and P.PROD_ID=SD.PROD_ID AND s.season_year = :p_season_year
AND CD.CUST_ID=CM.CUST_ID AND CD.CUST_ID=S.CUST_ID AND CD.COUNTRY NOT LIKE 'SPA%' AND Sd.PROD_ID LIKE 'CA%'
group by s.season_year,sd.prod_id,P.PROD_NAME
&sortthanks and regards
vikasVikas,
So, is your code producing an error when your report is called? Also, it would be helpful to know your Forms and Reports versions. Is ":p_season_year" set up as a USER_PARAMETER (UP) in your report or is it a true lexical parameter (meaning you should reference it with '&' instead of ':')? If it is a UP, the typical way to pass a value to this UP from Forms is to use a ParamList object instead of the REPORT_OTHER parameter of the Set_Report_Object_Property built-in. For example:
DECLARE
pl_id ParamList;
pl_name VARCHAR2(10) := 'REPORT34';
v_rep VARCHAR2(1000);
rep_status VARCHAR2(20);
BEGIN
pl_id := Get_Parameter_List(pl_name);
IF id_null(pl_id) THEN
pl_id := Create_Parameter_List(pl_name);
END IF;
Add_Parameter(pl_id, 'P_SEASON_YEAR', TEXT_PARAMETER, :SALE_ORDER.SEASON_YEAR);
repid := FIND_REPORT_OBJECT( 'REPORT34' );
v_rep := RUN_REPORT_OBJECT(repid, pl_id);
... rest of your code here ...
END;Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Help desiging a 10g Oracle Report with Matrix and Lexical Parameters - Long
Hello all:
I apologize in advance for this long post.... I'm using Oracle Reports 10g (9.0.4.0.33). First -- the question:
I need to create a Matrix where the rows come from one database table
(TABLE1) and the columns and cell contents come from a linked query (pulled from TABLE2) that is generated with lexical parameters based on the current TABLE1 row. The lexical parameters contain a WHERE clause for the TABLE2 query. Basically, I have a linked query between TABLE1 and TABLE2. I need to generate a Matrix around it.
Does anyone know if this is even possible?
Here's the background on the application, if that is helpful...
I have an application where I maintain database tables containing names/addresses along with information pertaining to them. As part of the processing, I need to produce reports that contain statistics based on values in the table. For example, each row has a field RTYPE that identifies the Record Type (1-Suppress, 2-Buyer, 3-Inquirer). Each row also has a last purchase date field. The statistics produced for this field would look like this:
2001 2002 2003 11/03 12/03 01/04 02/04 03/04 04/04 05/04 ...
Buyer 100 150 250 30 25 15 8 9 22 83
Inquirer 1000 800 493 ...
Suppress ... ...
Totals ... ...
Each cell contains the count of the number of records that have the corresponding RTYPE and Last Purchase date. The dates across the top are determined by the most recent purchase date in the file. We count the last 12 months, month by month, and then anything older than that is grouped by
year of purchase. So, the column headings are variable.
The SQL query for this example looks like this:
SELECT CASE WHEN rtype = '2' THEN 'Buyers'
WHEN rtype = '3' THEN 'Inquirers'
WHEN rtype = '1' THEN 'Suppress'
END HLDESC,
CASE WHEN MONTHS_BETWEEN(trunc(:MAXHLDATE,'MONTH'),
TRUNC(T.HOTLINE,'MONTH')) < 12
THEN TO_CHAR(T.HOTLINE,'YYYYMM')
ELSE TO_CHAR(T.HOTLINE,'YYYY') || '00'
END YYMM_8,
CASE WHEN MONTHS_BETWEEN(trunc(:MAXHLDATE,'MONTH'),
TRUNC(T.HOTLINE,'MONTH')) < 12
THEN TO_CHAR(T.HOTLINE,'MM/YY')
ELSE TO_CHAR(T.HOTLINE, 'YYYY')
END FmtDate_8,
COUNT(*) HLCOUNT
FROM &TABLENAME T
GROUP BY CASE WHEN rtype = '2' THEN 'Buyers'
WHEN rtype = '3' THEN 'Inquirers'
WHEN rtype = '1' THEN 'Suppress'
END,
CASE WHEN MONTHS_BETWEEN(trunc(:MAXHLDATE,'MONTH'),
TRUNC(T.HOTLINE,'MONTH')) < 12
THEN TO_CHAR(T.HOTLINE,'YYYYMM')
ELSE TO_CHAR(T.HOTLINE,'YYYY') || '00'
END,
CASE WHEN MONTHS_BETWEEN(trunc(:MAXHLDATE,'MONTH'),
TRUNC(T.HOTLINE,'MONTH')) < 12
THEN TO_CHAR(T.HOTLINE,'MM/YY')
ELSE TO_CHAR(T.HOTLINE, 'YYYY')
END
ORDER BY CASE WHEN MONTHS_BETWEEN(trunc(:MAXHLDATE,'MONTH'),
TRUNC(T.HOTLINE,'MONTH')) < 12
THEN TO_CHAR(T.HOTLINE,'YYYYMM')
ELSE TO_CHAR(T.HOTLINE,'YYYY') || '00'
END
There might be a better way to write this, but that isn't the issue at the moment.
I have many different tables, each with different fields. I need to produce counts on each of those fields. Some of those fields have a limited number of values where I need to count the occurrences and attach a description (like the RTYPE counts above). Others, like Last Purchase Amount, require counts within ranges (between 0 and 9.99, 10 and 19.99, etc.). Still others are "multiple choice"-style fields (such as products purchased), where we have multiple single-char flags that are not null when the corresponding products are purchased. In this case, we need to produce statistics that look like this:
2001 2002 2003 11/03 12/03 01/04 02/04 03/04 04/04 05/04 ...
Product 1 .........
Product 2 .........
The worst of the bunch is a field where I need to count the occurrence of each value within it (hundreds of values) without entering descriptions, so I don't know how many rows will appear ahead of time. This is used for "source codes" that identify where the name/address came from. They look similar to the RTYPE above, but the leftmost column contains each value from the field rather than a description. There are so many possible values and they change so often that it isn't feasible to enter a description for each one.
Right now, I manually create an Oracle Report for each table when I design/load it. This is becoming difficult to manage, since I have over 150 of them now. Each of these reports can have any number of matrices to display (the largest right now has about 25).
The new table structure to generate these reports consists of two tables: A COUNTHDR table and a COUNTROW table. The COUNTHDR table represents a single Matrix within the report. It contains info such as a heading for the Matrix and whether column totals should be calculated or not. The COUNTROW table contains a description for each row and an SQL Fragment that contains an appropriate WHERE clause to match the description. In the event of a "source code" style count, COUNTHDR has the name of the field to count. COUNTROWs won't exist, so I'll be handling those counts differently. But, ignoring that issue for now, the report structure looks like this:
+ Q1 +
|
+ COUNTHDR +
|
+ COUNTROW +
| linked query
+ Q2 +
|
+ COUNTDTL +
Q2 is the query with lexical parameters for the table and "where clause" that identifies the actual statistic I need counted. I need fields from COUNTROW and COUNTDTL to form a Matrix.
Can this be done? How?
Of course, if anyone out there has a better idea on how to achieve my goal of not writing a report per table, please let me know!! :-)
TIA
Eric Raskin
PS. This structure does not exactly duplicate my original query, since multiple Matrix rows are created by the single SQL query given in the example. Instead, I'll end up executing an SQL query for each row, which is less than desirable. The design will need some tweaking...
PPS. I have tried handling this problem by pre-counting the target table and storing the results in a COUNTCOL table, containing the details of the matrix. This actually does work, but the performance is terrible. I have one "source code"-style count that generated over 20,000 detail cells, including all the "0" cells needed to fill out the matrix. If you don't generate the "0" cells, you get holes in the matrix presentation and/or error messages (which I can explain if you wish). I never did get Oracle Reports to print this one -- I gave up after an hour of runtime on a P4 3GHz machine connected via Gigabit Ethernet to the server. Hence the attempt to push the SQL Queries back into the Oracle Report itself.
Eric H. Raskin Voice: 914-765-0500
Professional Advertising Systems Inc. Fax: 914-765-0503
200 Business Park Dr Suite 107 [email protected]
Armonk, NY 10504Hi there
here's example of my code
Html header of the page :
<script language="JavaScript" type="text/javascript">
function callMyPopup (formItem1,formItem2) {
var formVal1 = document.getElementById(formItem1).value;
var formVal2 = document.getElementById(formItem2).value;
var url;
url = 'f?p=&APP_ID.:8:&APP_SESSION.::::P8_PROJECT,P8_PDRL_NO:' + formVal1 + ',' + formVal2;
w = open(url,"winLov","Scrollbars=1,resizable=1,width=800,height=600");
if (w.opener == null)
w.opener = self;
w.focus();
</script>
troubleshooting
1.Test each parameter separate first - each work ?
2.Use code above, rerig it, create multiple parameter
3.try again...
hope this helps...
check your orginial source (page where items are) - what data -
Not all lexical parameters are being bound
Reports SQL parser is binding to only 2 of 4 variables. SQL TRACE option confirms this:
AND CABCHCK_CORT_CODE = :P_COURT_CODE
AND CABCHCK_LOCN_CODE = :P_COURT_LOCATION_CODE
AND CABCHCK.CABCHCK_DATE >= TO_DATE(:P_DATE_FROM)
AND CABCHCK.CABCHCK_DATE <= TO_DATE(:P_DATE_TO)
Bind Variable Value
P_COURT_CODE 23
P_COURT_LOCATION_CODE TC
Note that :P_DATE_FROM and :P_DATE_TO are not shown in the trace as a 'Bind Variable'. The error message when running the report is:
ORA-01008: not all variables bound
This is a report which has previously worked and where the SQL code and the lexical parameters have not changed (but the layout changed slightly). Could this be yet another corrupted .rdf file? If so, how is this circumvented?
Regards,
SteveThe issue has been found and solved.
The SQL code is loaded into a lexiconal variable and run from the query. For example,
:P_WHERE_COURT = 'and cabchck_cort_code = :p_court_code';
This was in the BEFORE_REPORT trigger. It worked.
However, the third and forth lines (with the TO_DATE function call) were not working. In the SQL statement, the functions referenced the :P_DATE fields but they weren't bound.
The date statements were loaded in the same BEFORE_REPORT trigger as the court and location lines. By moving all of the code into the AFTER_PARAMETER trigger, the errors went away and the SQL processed normally.
Why would this move from BEFORE_REPORT to AFTER_PARAMETER have done this? -
¶m lexical variable in SELECT clause
Is there a way to get Oracle*Reports to accept a lexical variable in the SELECT clause? The example is:
SELECT
table.column1,
table.column2,
&PARAM as column3
FROM
table
I am already using lexical variables in the WHERE clause, but getting one to work in the SELECT clause has thus far failed.
The SQL is accepted if :PARAM is used in place of &PARAM, but I am unable to actually vary the selected column this way.
The bind variable PARAM has the following code behind it in a BeforeReport trigger:
IF :ANOTHER_PARAM := 'ALL' THEN
:PARAM = 'ALL'
ELSE
:PARAM = 'table.column3'
When using :PARAM in the SELECT clause, the literals 'table.column3' are returned, not the contents of table.column3.Sorry for the wasted bandwidth. I found a solution. Here it is:
SELECT
table.column1,
table.column2,
CASE :P_USER
WHEN 'ALL' THEN 'ALL'
ELSE table.column3
END as column3 -
"Index: 0, Size: 0" error when using lexical references
I got "Index: 0, Size: 0" when using lexical references in data template. Can any body tell me what happen? The detail error is:
[042308_084608187][][EXCEPTION] java.lang.IndexOutOfBoundsException: Index: 0, S
ize: 0
at com.sun.java.util.collections.ArrayList.RangeCheck(ArrayList.java:492
at com.sun.java.util.collections.ArrayList.get(ArrayList.java:306)
at oracle.apps.xdo.dataengine.DataTemplateParser.getParentDataSource(Dat
aTemplateParser.java:1802)
at oracle.apps.xdo.dataengine.XMLPGEN.writeDefaultGroup(XMLPGEN.java:329
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:2
84)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:271)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:213)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:252)
at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProc
essor.java:390)
at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.ja
va:355)
at oracle.apps.xdo.servlet.data.bind.AdvancedQueryBoundValue11.callDataP
rocessor(AdvancedQueryBoundValue11.java:212)
at oracle.apps.xdo.servlet.data.bind.AdvancedQueryBoundValue11.getValue(
AdvancedQueryBoundValue11.java:101)
at oracle.apps.xdo.servlet.ReportContextImplV11.getReportXMLData(ReportC
ontextImplV11.java:399)
at oracle.apps.xdo.servlet.CoreProcessor.process(CoreProcessor.java:143)Here is the data template, the lexical reference is &where_clause, thanks.
<dataTemplate name="Tamplate" dataSourceRef="dmdb" defaultPackage="RRBY_PKG">
<properties>
<property name="debug_mode" value="on"/>
</properties>
<parameters>
<parameter name="BUName" dataType="character"/>
<parameter name="StartDate" dataType="date"/>
<parameter name="EndDate" dataType="date"/>
</parameters>
<dataTrigger name="beforeReport" source="RRBY_PKG.dynamic_where(BUName => :BUName)"/>
<dataQuery>
<sqlstatement name="GroupByAgent">
<![CDATA[SELECT
NVL(businessunit.name, 'Unassigned') UNITNAME,
queue.name QUEUENAME,
NVL2(businessunit.name, 'Unassigned', businessunit.name || ': ' || queue.name) FULLQUEUENAME,
COUNT(queueEvent.requestNumber) REQNUM
FROM((((queueevent queueevent
INNER JOIN assignment assignment ON queueevent.assignmentkey = assignment.assignmentkey)
INNER JOIN datedim datedim ON queueevent.datekey = datedim.datekey)
INNER JOIN businessunit businessunit ON queueevent.businessunitkey = businessunit.businessunitkey)
INNER JOIN queue queue ON queueevent.forwardedqueuekey = queue.queuekey)
INNER JOIN timedim timedim ON queueevent.timekey = timedim.timekey
WHERE dateDim.FULLDATE >= TO_DATE(:StartDate, 'yyyy-mm-dd')
AND BW_COMMON_DATEADD('s', timeDim.SECONDOFDAY, BW_COMMON_DATEADD('s', queueEvent.EVENTDURATION, dateDim.FULLDATE)) > TO_DATE(:StartDate, 'yyyy-mm-dd')
AND BW_COMMON_DATEADD('s', timeDim.SECONDOFDAY, BW_COMMON_DATEADD('s', queueEvent.EVENTDURATION, dateDim.FULLDATE)) < TO_DATE(:EndDate, 'yyyy-mm-dd') AND &where_clause
group by businessunit.name, queue.name]]>
</sqlstatement>
</dataQuery>
</dataTemplate> -
Hello,
In my beforereport trigger, I have Lexical parameter defined as:
:LP_CUSIP := 'WHERE F.TS_CUSIP = SUBSTR(A.FUND_CUSIP,1,9) AND F.TS_CUSIP = SUBSTR('||''||:PM_FUND||''||',1,9)
But It gives a REP-1401 :'beforereport': Fatal PL/SQL error occured.
ORA-06502 : PL/SQL : numeric or value error.
But the query works fine with :
where
f.ts_cusip = substr(a.FUND_CUSIP,1,9)
and f.ts_cusip = SUBSTR('351899992000',1,9)
Any help would be appreciated.
Thanks.hi,
How are you building the query in the data model?
I'd do this in the data model:
select
from
where ...(another conditions you have or 1=1) &lp_cusip
And in the "after parameter form",I'd put this code:
:LP_CUSIP := 'and F.TS_CUSIP = SUBSTR(A.FUND_CUSIP,1,9) AND F.TS_CUSIP = SUBSTR('||''''||:PM_FUND||',1,9)'||'''';
aguero
================
Gives the compilation error -
Passing Condition as lexical parameter
Hi All,
I am developing one XML report by using XML Dtata templet.
I have the require ment like to check the cdition on bassis of the USER Parameter value if the parameter is null then place the min and max value of the column.
In my data templet I declare the lexical parameter
And in my PL/SQL package I declare the function where I am building the string.
When I am submitting the cuncorrent program it is throughing me the error.
Data templet
<?xml version="1.0" encoding="UTF-8" ?>
<dataTemplate name="XXGLR005_1" defaultPackage="XXX_GL_GLSPF_XMLP_PKG" version="1.0">
<properties>
<property name="include_parameters" value="true"/>
<property name ="debug_mode" value="on" />
</properties>
<parameters>
<parameter name="p_ledger" dataType="varchar2"/>
<parameter name="p_balancing" dataType="varchar2"/>
<parameter name="p_start_period" dataType="varchar2"/>
<parameter name="p_end_period" dataType="varchar2"/>
<parameter name="p_start_fc" dataType="varchar2"/>
<parameter name="p_end_fc" dataType="varchar2"/>
<parameter name="p_start_site" dataType="varchar2"/>
<parameter name="p_end_site" dataType="varchar2"/>
<parameter name="p_where" dataType="varchar2"/>
</parameters>
<lexicals>
</lexicals>
<dataQuery>
<sqlStatement name="Q_1">
<![CDATA[
SELECT account,
account_description,
SUM (amount_period_range) amount_period_range,
SUM (fisical_ytd_amount) fisical_ytd_amount,
SUM (cumilative_found) cumilative_found,
account_type,actual_flag,period_name
FROM (SELECT gcc.segment4 ACCOUNT, ffv.description account_description,
(CASE ba.currency_code
WHEN 'CAD'
THEN (ba.period_net_dr - ba.period_net_cr)
ELSE (ba.period_net_dr_beq - ba.period_net_cr_beq)
END
) AS amount_period_range,
(CASE ba.currency_code
WHEN 'CAD'
THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
+ (ba.period_net_dr - ba.period_net_cr)
ELSE ( (ba.begin_balance_dr_beq
- ba.begin_balance_cr_beq
+ (ba.period_net_dr_beq - ba.period_net_cr_beq)
END
) AS fisical_ytd_amount,
(CASE ba.currency_code
WHEN 'CAD'
THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
+ (ba.project_to_date_dr - ba.project_to_date_cr
ELSE ( (ba.begin_balance_dr_beq
- ba.begin_balance_cr_beq
+ ( ba.project_to_date_dr_beq
- ba.project_to_date_cr_beq
END
) AS cumilative_found,
gcc.account_type account_type, ba.period_name,
ba.actual_flag
FROM gl_code_combinations gcc,
gl_balances ba,
gl_periods gp,
fnd_flex_value_sets fvs,
fnd_flex_values_vl ffv
WHERE gcc.code_combination_id = ba.code_combination_id
AND ba.period_name = gp.period_name
AND ffv.flex_value_set_id = fvs.flex_value_set_id
AND ffv.flex_value = gcc.segment4
AND fvs.flex_value_set_name = 'AHS_ACCOUNT'
AND ba.actual_flag <> 'B'
AND gcc.segment1 = '101'
&p_where
AND gcc.segment2 BETWEEN '0006' AND '0006'
AND gcc.segment4 = '31030000'
AND gp.start_date >= TO_DATE ('01/08/2010', 'DD-MM-YYYY')
AND gp.end_date <= TO_DATE ('30/11/2010', 'DD-MM-YYYY')
AND gcc.account_type IN ('E', 'R'))
GROUP BY period_name, actual_flag, ACCOUNT, account_description, account_type
]]>
</sqlStatement>
<sqlStatement name="Q_2">
<![CDATA[
SELECT NAME LEDGER_NAME
FROM gl_ledgers
WHERE ledger_id =:p_ledger
]]>
</sqlStatement>
</dataQuery>
<dataTrigger name="beforeReportTrigger" source="XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP" />
<dataStructure>
<group name="G_1" source="Q_1">
<element name="account" value="account"/>
<element name="account_description" value="account_description"/>
<element name="amount_period_range" value="amount_period_range"/>
<element name="fisical_ytd_amount" value="fisical_ytd_amount"/>
<element name="cumilative_found" value="cumilative_found"/>
<element name="account_type" value="account_type"/>
</group>
<group name="G_2" source="Q_2">
<element name="LEDGER_NAME" dataType="varchar2" value="LEDGER_NAME"/>
</group>
</dataStructure>
</dataTemplate>
Package Specification
CREATE OR REPLACE PACKAGE APPS.XXX_GL_GLSPF_XMLP_PKG AUTHID CURRENT_USER AS
-- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
-- Author's Name : Nihar Ranjan Panda
-- RICE Object id : GL-REP-05
-- Purpose : Package Specification
-- Program Style :
-- Maintenance History
-- Date Version# Name Remarks
-- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
--Global Parameters
p_ledger varchar2(100);
p_balancing varchar2(10);
p_start_period varchar2(10);
p_end_period varchar2(10);
p_start_fc varchar2(20);
p_end_fc varchar2(20);
p_start_site varchar2(10);
p_end_site varchar2(10);
p_start_mail_id varchar2(30);
p_end_mail_id varchar2(30);
p_purge_history varchar2(10);
p_where varchar2(1000);
P_CONC_REQUEST_ID number;
type spf_ref_cursor is REF CURSOR;
type rec_spf is record
account varchar2(20),
account_description varchar2(100),
amount varchar2(20),
account_type varchar2(1),
currency varchar2(3),
gl_date varchar2(11),
je_category varchar2(50),
code_combination_id varchar2(100),
line_description gl_je_lines.description%Type,
batch_name gl_je_batches.NAME%Type,
je_line_num gl_je_lines.je_line_num%TYPE,
--transaction_date varchar2(11),
je_header_num gl_je_headers.je_header_id%Type
function XXX_GL_SPF_SUMMARY_REP return boolean;
END XXX_GL_GLSPF_XMLP_PKG;
Package body
CREATE OR REPLACE PACKAGE BODY APPS.XXX_GL_GLSPF_XMLP_PKG
AS
-- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
-- Author's Name : Nihar Ranjan Panda
-- RICE Object id : GL-REP-05
-- Purpose : Package Body
-- Program Style :
-- Maintenance History
-- Date Version# Name Remarks
-- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
FUNCTION XXX_GL_SPF_SUMMARY_REP
RETURN BOOLEAN
IS
l_min_fc VARCHAR2 (20) := '';
l_max_fc VARCHAR2 (20) := '';
l_min_site VARCHAR2 (20) := '';
l_max_site VARCHAR2 (20) := '';
l_start_date VARCHAR2 (11) := '';
l_end_date VARCHAR2 (11) := '';
BEGIN
IF p_start_fc IS NULL
THEN
SELECT MIN (flex_value)
INTO l_min_fc
FROM fnd_flex_values_vl
WHERE flex_value_set_id =
(SELECT flex_value_set_id
FROM fnd_flex_value_sets
WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
p_start_fc := l_min_fc;
END IF;
IF p_end_fc IS NULL
THEN
SELECT MAX (flex_value)
INTO l_max_fc
FROM fnd_flex_values_vl
WHERE flex_value_set_id =
(SELECT flex_value_set_id
FROM fnd_flex_value_sets
WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
p_end_fc := l_max_fc ;
END IF;
IF p_start_site IS NULL
THEN
SELECT MIN (flex_value)
INTO l_min_site
FROM fnd_flex_values_vl
WHERE flex_value_set_id = (SELECT flex_value_set_id
FROM fnd_flex_value_sets
WHERE flex_value_set_name = 'AHS_SITE');
p_start_site :=l_min_site;
END IF;
IF p_end_site IS NULL
THEN
SELECT MAX (flex_value)
INTO l_max_site
FROM fnd_flex_values_vl
WHERE flex_value_set_id = (SELECT flex_value_set_id
FROM fnd_flex_value_sets
WHERE flex_value_set_name = 'AHS_SITE');
p_end_site := l_max_site;
END IF;
SELECT TO_CHAR (start_date, 'DD-MM-YYYY')
INTO l_start_date
FROM gl_periods
WHERE period_name = p_start_period;
SELECT TO_CHAR (end_date, 'DD-MM-YYYY')
INTO l_end_date
FROM gl_periods
WHERE period_name = p_end_period;*/
p_where := ('AND gcc.segment3 BETWEEN '''|| p_start_fc ||''' AND '''||p_end_fc||''
AND gcc.segment2 BETWEEN '''|| p_start_site ||''' AND '''||p_end_site||'''
AND gp.start_date >= '''||TO_DATE (l_start_date,'DD-MM-YYYY')||'''
AND gp.end_date <= '''||TO_DATE (l_end_date,'DD-MM-YYYY')||''''*/
RETURN (TRUE);
EXCEPTION
WHEN OTHERS
THEN
raise_application_error (-20101,NULL);
NULL;
END XXX_GL_SPF_SUMMARY_REP;
END XXX_GL_GLSPF_XMLP_PKG;
Error file
Custom Extensions: Version : UNKNOWN
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXGLR005 module: AHS GL SPF Summary Report
Current system time is 07-DEC-2010 23:39:22
XDO Data Engine Version No: 5.6.3
Resp: 20434
Org ID : 82
Request ID: 3275555
All Parameters: p_ledger=2021:p_balancing=101:p_start_period=AUG-10:p_end_period=NOV-10:p_start_fc=71110600018:p_end_fc=71110600018:p_start_site=0006:p_end_site=0006
Data Template Code: XXGLR005
Data Template Application Short Name: XXX
Debug Flag: N
{p_end_period=NOV-10, p_end_fc=71110600018, p_end_site=0006, p_start_fc=71110600018, p_balancing=101, p_start_period=AUG-10, p_ledger=2021, p_start_site=0006}
Calling XDO Data Engine...
[120710_113928978][][STATEMENT] Start process Data
[120710_113928979][][STATEMENT] Process Data ...
[120710_113928981][][STATEMENT] Executing data triggers...
[120710_113928981][][STATEMENT] BEGIN
XXX_GL_GLSPF_XMLP_PKG.p_ledger := :p_ledger ;
XXX_GL_GLSPF_XMLP_PKG.p_balancing := :p_balancing ;
XXX_GL_GLSPF_XMLP_PKG.p_start_period := :p_start_period ;
XXX_GL_GLSPF_XMLP_PKG.p_end_period := :p_end_period ;
XXX_GL_GLSPF_XMLP_PKG.p_start_fc := :p_start_fc ;
XXX_GL_GLSPF_XMLP_PKG.p_end_fc := :p_end_fc ;
XXX_GL_GLSPF_XMLP_PKG.p_start_site := :p_start_site ;
XXX_GL_GLSPF_XMLP_PKG.p_end_site := :p_end_site ;
XXX_GL_GLSPF_XMLP_PKG.p_where := :p_where ;
:XDO_OUT_PARAMETER := 1;
END;
[120710_113928985][][STATEMENT] 1:2021 :
[120710_113928985][][STATEMENT] 2:101 :
[120710_113928985][][STATEMENT] 3:AUG-10 :
[120710_113928985][][STATEMENT] 4:NOV-10 :
[120710_113928985][][STATEMENT] 5:71110600018 :
[120710_113928985][][STATEMENT] 6:71110600018 :
[120710_113928985][][STATEMENT] 7:0006 :
[120710_113928985][][STATEMENT] 8:0006 :
[120710_113928985][][STATEMENT] 9:null :
[120710_113929388][][STATEMENT] Executing data triggers...
[120710_113929388][][STATEMENT] Declare
l_flag Boolean;
BEGIN
l_flag := XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP ;
if (l_flag) then
:XDO_OUT_PARAMETER := 1;
end if;
end;
[120710_113929420][][STATEMENT] p_ledger
[120710_113929420][][STATEMENT] p_balancing
[120710_113929420][][STATEMENT] p_start_period
[120710_113929420][][STATEMENT] p_end_period
[120710_113929420][][STATEMENT] p_start_fc
[120710_113929420][][STATEMENT] p_end_fc
[120710_113929421][][STATEMENT] p_start_site
[120710_113929421][][STATEMENT] p_end_site
[120710_113929421][][STATEMENT] p_where
[120710_113929421][][STATEMENT] Writing Data ...
[120710_113929426][][STATEMENT] &p_where
java.lang.NullPointerException
at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1754)
at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1473)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:456)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:445)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:308)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:273)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:215)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:254)
at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProcessor.java:390)
at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:355)
at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:334)
at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:294)
at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
Start of log messages from FND_FILE
End of log messages from FND_FILE
Executing request completion options...
Finished executing request completion options.
Concurrent request completed
Current system time is 07-DEC-2010 23:39:29
Could any body please help me fixing this issue...Nihaapps,
It seems like you are missing a default value for p_where. If data templates have the same requirements as RDFs, then lexicals must have a default value that will be valid when the query is verified. The query would have to be checked for validity, and to do that, it has to fill in a value where &p_where is.
Kurz -
How to use a lexical variable in a WHERE clause and as a function argument.
Hello,
My report has a lexical variable which has values like 'and id in (1,3,4)'. I want to use this variable in two separate queries. In the first, it is used in the WHERE clause, something like:
.. where date is not null &var;
In the second query, the variable is used in a function call, something like:
select * from table (my_function(&var));
The trouble is that the first query works when the value of the variable is unquoted, but for the second query the value should be quoted.
Does anyone have an idea how I could solve this problem?
Thanks in advance,
Frans
Message was edited by:
fransiehttp://tkyte.blogspot.com/2006/06/varying-in-lists.html
Presents many options. -
How to include lexical parameters in IN string in SQL QUERY BUILDER ?
Hi,
I have to write an SQL Query in SQL QUERY BUILDER in Reports 6i to retrieve all details pertaining to donor codes i insert randomnly at runtime.
The Statement is like this
SELECT TITLE_TAB.TITLE_CODE,DONOR_TAB.DONOR_CODE, DONOR_TAB.FIRST_NAME,DONOR_TAB.MIDDLE_NAME,DONOR_TAB.LAST_NAME,CITY_MASTER_TAB.CITY_CODE FROM DONOR_TAB,CITY_MASTER_TAB,TITLE_TAB
WHERE DONOR_CODE IN (1,2,6,70,....)
I cannot use lexical parameter '&' in SQL QUERY BUILDER as i have to use bind variable donor_code.
How do i do it?How do i do that? Can you give me an example of how i can go about with it?
-
How to use lexical paramter in oracle reports
I have a query like,
select * from t1 where &c1=:v_srep;
where t1 is tablename
c1 is column name
How do I create &c1 and how should I populate it ?
Thanks,From Oracle 8.1.5 database, we can use dynamic ref cursors.
With dynamic ref cursor we can really avoid the use of lexical parameters in Reports.
With static ref cursor this is not possible in all cases.
For example, if we need dynamic WHERE, we practically can't use static ref cursor.
But, problem is that Reports needs static ref cursor type for building Report Layout.
Solution (as i know, first published in my post in MetaLink Reports Forum,
thread "Report based on Ref Cursor or PL/SQL Table", 24-Aug-01) is:
in package specification we must have both ref cursor types,
static for Report Layout and dynamic for ref cursor query.
Dynamic ref cursor examples:
"Dynamic Table in the Second Query with Oracle Reports"
http://www.quest-pipelines.com/pipelines/plsql/tips03.htm#JULY
"Using a Collection Instead of a Temporary Table in Complex Reports"
http://www.quest-pipelines.com/pipelines/plsql/tips03.htm#NOVEMBER
Regards,
Zlatko Sirotic -
Lexical References in oracle.apps.fnd.flex.kff.select
Hi,
I have one XML report and I am trying to Implement the Lexical References in Select.
The bellow Code I wrote under <Lexical> tag
<lexical type="oracle.apps.fnd.flex.kff.select" name="C_dest_locator_value" application_short_name="INV" id_flex_code="MTLL" id_flex_num=":P_STRUCT_NUM" segments="ALL" code_combination_table_alias="mil" multiple_id_flex_num="N" show_parent_segments="Y" output_type="VALUE"/>
But in the Data It is retrieving as
<C_DEST_LOCATOR_VALUE>fnd_flex_xml_publisher_apis.process_kff_combination_1('C_dest_locator_value', 'INV', 'MTLL', 101, mil.ORGANIZATION_ID, mil.INVENTORY_LOCATION_ID, 'ALL', 'Y', 'VALUE')</C_DEST_LOCATOR_VALUE>
And in the RTF template I wrote the code as
<?if:not(contains(C_DEST_LOCATOR_VALUE,'fnd_flex'))?><?C_DEST_LOCATOR_VALUE?><?end if?>
But It is not displaying any thing. Any one has any clue what was went wrong on this.
Please help me on this As one deliverable is pending .
Thanks
NiharWhat is your application release?
Not sure if I understand you correctly, but have you reviewed (How To Use Oracle.Apps.Fnd.Flex.Kff.Select To Retrieve Particular Segments And Not All Segments from a Flexfield [ID 1267032.1]) and see if it helps?
Thanks,
Hussein
Maybe you are looking for
-
Boot Camp Partition & Windows Vista - Disk format Problems
When Boot camp partitions the disk (I chose 25gb) it automatically formatted it as FAT32. However, when installing Vista, it says that it requires the disk to be formatted as NTFS. The Boot camp instructions says I should be given the option which fo
-
Issues during F110 - Payment of invoice posted last year
Hi gurus, Last month we had some problems during the payment of several invoices because they have been posted last year. When the user is trying to pay it, the system shows the following message: u201CFI234 u2013 Different FM fiscal years: Invoice X
-
Bug in new asdoc rules in Flex PMD 1.1
ASDoc rules failing when there is metadata between asdoc comment and attributes/methods/classes https://bugs.adobe.com/jira/browse/FLEXPMD-167
-
BONSOIR J'AI UN PREBLEME AVEC MON ORDINATEUR L'ENOVO B590 JE NE PEUX PAS VOUS EXPLIQUEZ MAIS JE VOUS ENVOYE CE QU'IL AFFICHE SUR L'ECRAN Admin edit; translation; (translate.google.com) Good evening, I have a problem with my Lenovo B590 computer. I c
-
Should I implement a lookup table?
I'm running a test that requires me to output an N-bit word and input a 50-bit boolean array which I need to compare to the expected 50-bit boolean array. How should I implement storing these "expected boolean arrays" for easy comparison in my 'pass