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
Similar Messages
-
Use lexical parameter in select statement
Hi,
I have a report like below:
select d.dname, &par1 mgrSal, &par2 empSal from emp e, dept d where d.deptno=e.deptno
and d.deptno = :dno;
Here the &par1 and &par2 are calling a function like:
:par1 := ' f(:dno, :job)';
in the after parameter form. the function returns a number ( something like count(*) or max(sal) ).
Now the reports server (6i) generats error message:
inlalid column or miss expression.
What is the right way for this kind of report? Please help me.
Any help is greatly appreciated.Hi,
I have a report like below:
select d.dname, &par1 mgrSal, &par2 empSal from emp e, dept d where d.deptno=e.deptno
and d.deptno = :dno;
Here the &par1 and &par2 are calling a function like:
:par1 := ' f(:dno, :job)';
in the after parameter form. the function returns a number ( something like count(*) or max(sal) ).
Now the reports server (6i) generats error message:
inlalid column or miss expression.
What is the right way for this kind of report? Please help me.
Any help is greatly appreciated.
Try debugging it in the same good old way.
What you have stated seems to have no problem
but you never know. So In the after param form see whether it is actually setting a value to your parameter.
If that is Ok I dont think you should have problems.
But there are two things which look odd here. since the Parameter value is not changing after the after param form why do you need it in the query?
Second If you are trying to display the departments thier emp count and max salary I think You can use straight selects than anyhting else.
Try doing it
vij -
Discoverer reports shows 'NULL' in columns where is no data
Hi All,
Discoverer report is showing NULL in columns where is no data.
please advise ASAP.
E-biz: 12.0.6
Database: 11.2.0.2
Discoverer: 10.1.2.55.26
Thanks in advance.
Regards
KumarIn Discoverer BI DEsktop By default, it uses “NULL” text, but we can show Zero or blank then that report is executed as text report.
how can we set it as for all reports as default blank or zero.Have you reviewed the docs referenced above?
Please see these docs.
Discoverer 10.1.2/11g Worksheets Do Not Display Expected Null Format Setting After Modifying Tools Options [ID 311841.1]
Workbooks Show Wrong Null Format in Viewer/Plus After New Install or Upgrade from 4i to 10.1.2 [ID 352194.1]
Thanks,
Hussein -
Generation of XML Tags for columns in Lexical parameter in select query
Hi,
I have lexical parameter in my select statement of my data model in the report.
How do i generate XML tags for these columns inside a Lexical Parameter?
Simple Example: I have data model query as follows:
SELECT msi.inventory_item_id
&LP_SELECT
FROM mtl_system_items_b
Here my lexical Parameter LP_SELECT is generated in before report trigger as follows in my report:
:LP_SELECT := 'msi.segment1,msi.description';
So, the question is how to generate XML Tags for columns in Lexical Parameter(as in the example above, i need XML tags for these columns - segment1 and description)
Thanks,
Ratantry 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 -
Passing value as a parameter in select statement
Hi,
Very simple query, how do I pass the values that i get in the cursor to a select statement. If table1 values are 1,2,3,4 etc , each time the cursor goes through , I will get one value in the variable - Offer
So I want to pass that value to the select statement.. how do i do it?
the one below does not work.
drop table L1;
create table L1
(col1 varchar(300) null) ;
insert into L1 (col1)
select filter_name from table1 ;
SET SERVEROUTPUT ON;
DECLARE
offer table1.col1%TYPE;
factor INTEGER := 0;
CURSOR c1 IS
SELECT col1 FROM table1;
BEGIN
OPEN c1; -- PL/SQL evaluates factor
LOOP
FETCH c1 INTO offer;
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(offer);
select * from table1 f where f.filter_name =:offer ;
factor := factor + 1;
DBMS_OUTPUT.PUT_LINE(factor);
END LOOP;
CLOSE c1;
END;Hi Greg,
Thanks for the response, No there is no ODB.net involved here.
If I remove the : from :offer. I get this error now.
Changed SQL is:
select * from table1 f where f.filter_name =offer ;
Error report:
ORA-06550: line 16, column 23:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 16, column 9:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action: -
Dynamic Parameter LOV Select Statement
I have a parameter form with a value for the fiscal year and equipment ID. I want to populate the equipment ID list of values based on the fiscal year that is selected.
My query for the equipment ID list of values would be SELECT EQPID,NAME FROM EQPLIST WHERE FY = :FY.
When I tried to add this query to the list of values of the equipment ID parameter I get REP-0781: Bind variables are not allowed in the Select statement.
Is there a way to dynamically generate the list of values select statement in a reports trigger?Hi,
What version of Oracle Reports are you using?
Unfortunately, it is a limitation of Oracle Reports to not restrict values based on other parameters - for sure until Reports 6i and I believe until the recent new versions.
The other way to do what you want to do is to do it outside of Reports, if you have an Oracle Forms application. For example, you can create a simple Oracle Form that captures the Report parameters and then submits the report from the Forms. In Forms, you can implement the solution you are looking for - restricting values based on values of other parameters. In reports, you can't do that.
If you have a few other reports that have similar requirements, then you can create a form to launch reports and submit all your reports from there after capturing all your parameters there.
Venkat -
Passing parameter into select statement by using function in discoverer
I have created two functions in database named Period_in and Period_out and a global variable g_period_name
I have called Period_out function in VIEW(Select statement where condition).
I have registered Period_in function in discoverer admin then created calculation (called Period_in(:input parameter))in discoverer plus.
My expectation is user will enter period name and that will hit Period_in function and returns 1 and stores entered period name in g_period_name at runtime. then VIEW will executed and fetches data.
But i am getting no data found.
Problem is 2 functions running at the same time in select statement. Please help me to overcome this. Thanks in advance
FUNCTION period_in (p_period VARCHAR2)
RETURN NUMBER
AS
BEGIN
g_period_name := p_period;
RETURN 1;
END period_in;
FUNCTION period_out
RETURN VARCHAR2
AS
BEGIN
RETURN g_period_name;
END period_out;You can use this code:
WITH cte
AS ( SELECT EmpID ,
EmpName ,
[dbo].[udf_testFunction](EmpID) AS testfunctionvalue
FROM #Temp
SELECT EmpID ,
EmpName ,
testfunctionvalue ,
testfunctionvalue * EmpID ,
testfunctionvalue + 2
FROM cte
But using scalar functions in select clause can hurt the performance. Please see this link:
SQL Server Scalar User Defined Function Performance
T-SQL Articles
T-SQL e-book by TechNet Wiki Community
T-SQL blog -
Lexical parameter in SELECT INTO (Very Urgent)
I have to write a query which takes some value & put it into a variable. but i have to use lexical parameter in my query.
e.g
select sal into v_sal
from emp
where deptno=20 &p_lexpara;
the form amd report builder do not compile this syntax & give error on &p_lexpara
Pl. help me out
ThanksIn Report Builder you can not use clause INTO.
Correct one is:
select sal
from emp
where deptno=20 &p_lexpara
In Forms you can not use lexical parameter but you can create lexical parameter in CREATE_GROUP_FROM_QUERY. So you can create record group in this way and then use lexical parameter like:
DECLARE
rg_name VARCHAR2(40) := 'Salary';
rg_id RecordGroup;
errcode NUMBER;
BEGIN
** Make sure group doesn't already exist
rg_id := Find_Group( rg_name );
** If it does not exist, create it and add the two
** necessary columns to it.
IF Id_Null(rg_id) THEN
rg_id := Create_Group_From_Query( rg_name,
'select sal from emp where deptno=20 '||p_lexpara;
END IF;
** Populate the record group
errcode := Populate_Group( rg_id );
END;
and then with Get_Group_Number_Cell you can retrive values of SAL e.g something like:
status := Populate_Group( rg_id );
*/ *** Zero status is success*** /
IF status = 0 THEN
match := Get_Group_Number_Cell('Salary.SAL',1);
Message('The Salary is '||to_CHAR(match));
ELSE
Message('Error creating query record group.');
RAISE Form_Trigger_Failure;
END IF; -
Select statement showing error
Hi,
Please view below select statement and give your feedback:
SELECT vbrk~vkorg
vbrk~vtweg
vbrk~kunrg
vbrk~kunag
vbrk~knumv " Number of document cindition.
vbrk~fksto " Cancelled Invoice
vbrk~vbtyp " SD Document Category
vbrk~vbeln
vbrk~fkart
vbrk~inco1
vbrk~erdat
vbrk~ernam
vbrk~fkdat
vbrp~spart
vbrp~werks
vbrp~matnr
vbrp~arktx
vbrp~fkimg
vbrp~ntgew
vbrp~mwsbp
vbrp~posnr
INTO (IT_INV-vkorg,
IT_INV-VTWEG,
IT_INV-KUNRG,
IT_INV-KUNAG,
IT_INV-KNUMV,
IT_INV-FKSTO,
IT_INV-VBTYP,
IT_INV-VBELN,
IT_INV-FKART,
IT_INV-INCO1,
IT_INV-ERDAT,
IT_INV-ERNAM,
IT_INV-FKDAT,
IT_INV-SPART,
IT_INV-WERKS,
IT_INV-MATNR,
IT_INV-ARKTX,
IT_INV-FKIMG,
IT_INV-NTGEW,
IT_INV-MWSBP,
IT_INV-POSNR)
*INTO CORRESPONDING FIELDS OF TABLE IT_INV
FROM VBRK INNER JOIN VBRP
ON VBRKVBELN = VBRPVBELN
WHERE VBRK~VBELN IN S_VBELN
AND FKART IN S_FKART
AND FKDAT IN S_FKDAT
AND WERKS IN S_WERKS
AND FKART NOT IN ('S1','S2','S3')
AND FKSTO NE 'X'.As you are moving the fields to variables, use enselect as the last statement and append the internal table before it.
If you uncomment the the line "into corresponding fields of table internal table" and comment the individual destination fields you can avoid the syntax error. or else use SELECT SINGLE statement if you are selecting a single record.
* (IT_INV-vkorg, IT_INV-VTWEG, IT_INV-KUNRG, IT_INV-KUNAG, IT_INV-KNUMV, IT_INV-FKSTO,
*IT_INV-VBTYP, IT_INV-VBELN, IT_INV-FKART, IT_INV-INCO1, IT_INV-ERDAT,IT_INV-ERNAM,
*IT_INV-FKDAT, IT_INV-SPART, IT_INV-WERKS, IT_INV-MATNR, IT_INV-ARKTX, IT_INV-FKIMG,
*IT_INV-NTGEW, IT_INV-MWSBP, IT_INV-POSNR)
INTO CORRESPONDING FIELDS OF TABLE IT_INV -
Problem executing SELECT statement due to st_spatial column type
I am using a CachedRowSet and cache.execute() will not run because it does not support the st_spatial column type. I have been told to use the column metadata to build a select statement of column names, and check the column's type before you add it to the select clause. But, I am unsure of what to do since I can't get column names without running a select statement first... I will attach some code for you to look at, but please give me suggestions!
try{
Class.forName("com.informix.jdbc.IfxDriver");
CachedRowSet cache = new CachedRowSet();
cache.setReadOnly(true);
cache.setUrl(dbname);
cache.setUsername(user);
cache.setPassword(password);
cache.setCommand("SELECT * FROM "+table);
try{
cache.execute();
}catch(Exception e){
out.print("Can't Display");
OTHER JSP CODE THAT WORKS WITH THE RESULTS FROM ABOVE
}catch(Exception exc){
out.println(exc.toString());
} // end try-catchI honestly don't have a clue. I have no idea what the st_spatial data type is, or where it is defined, and as a result, I don't know why Java would be complaining about it. I do know that java.sql.ResultSet doesn't care about it (it would internally recognize it as a plain old object type via the getObject() method and you would have to cast it to st_spatial).
What I would check:
Is the Informix driver up to date?
Does the CachedRowSet class extend ResultSet or otherwise use it as an internal data structure? If so, does it properly create the ResultSetMetaData object and no exceptions are being trapped?
Otherwise... when copying data from the ResultSet object into its own internal data structure, does it correctly realize that the st_spatial column should NOT be copied into a String or a slot in a String array?
Does a quick and dirty command line version of your program properly use CachedRowSet to retrieve at least one record from your database?
Basically, put the JSP aside and just test the CachedRowSet to make sure it is working correctly. I have no idea what's in that class since it is not a Java standard class, so I can't really give you any additional suggestions. -
Dynamic UPDATE statement with parameters for column names.
Hello,
On this* website I read "The SQL string can contain placeholders for bind arguments, but bind values cannot be used to pass in the names of schema objects (table or column names). You may pass in numeric, date, and string expressions, but not a BOOLEAN or NULL literal value"
On the other hand, in this Re: execute immediate with dynamic column name update and many other
posts people use EXECUTE IMMEDIATE to create a dynamic UPDATE statement.
dynSQL:='UPDATE CO_STAT2 CO SET CO.'||P_ENT_B_G_NAME||' = '||P_ENT_E_G_WE||'
WHERE ST IN
(SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
'||P_ST||' = CO.ST AND
CO.'||P_ENT_E_G_NAME||' > '||P_ENT_E_G_WE||' AND
CO.'||P_ENT_B_G_NAME||' < '||P_ENT_E_G_WE||');';
EXECUTE IMMEDIATE dynSQL ;
Since this statement is part of a Stored Procedure, I wont see the exact error but just get a ORA-06512.
The compiling works fine and I use Oracle 11g.
http://psoug.org/definition/EXECUTE_IMMEDIATE.htmOK I extracted from all of your posts so far that I have to use "bind-variables with :"
From all the other tuorials and forums posts, I assume using the pipe is correct so I added those as well into the script:
set serveroutput on format wraped;
DECLARE
dynSQL VARCHAR2(5000);
P_ENT_E_G_NAME VARCHAR2 (100) :='test1'; P_ENT_E_G_WE VARCHAR2 (100) :='01.02.2012'; P_ENT_B_G_NAME VARCHAR2 (100) :='01.01.2012';
P_ST VARCHAR2 (100) :='32132';
BEGIN
dynSQL:= 'UPDATE CO_STAT2 CO SET CO.'||:P_ENT_B_G_NAME||' = '||:P_ENT_E_G_WE||'
WHERE ST IN (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
'||:P_ST||' = CO.ST AND
CO.'||:P_ENT_E_G_NAME||' > '||:P_ENT_E_G_WE||' AND
CO.'||:P_ENT_B_G_NAME||'
< '||:P_ENT_E_G_WE||')';
--this is somehow missing after the last < '||:P_ENT_E_G_WE||')';
dbms_output.enable;
dbms_output.put(dynSQL);
--EXECUTE IMMEDIATE dynSQL;
END;Problem:I think I figured it out, the dates that I parse into the query need additional ' -
How to spool the null alias column names in sppol file
Hi,
I have to spool the data and having some issues.
SELECT DISTINCT a.market_name,a.market_code,*''as empid* from ssp2_pcat.markets a ;
in the above select sql I have created extra null column as empid
when I spool with tild dilimited I am not getting column name(empid) in spool file.
a.market_name||'~'||a.market_code||'~'||'''empid'
SSB ~25010~' empid
In the feed file it should be null. but the alias column is populted with empid
Can you please let me know what is wrong here?
Thanks,SELECT DISTINCT a.market_name,a.market_code,*''as empid* from ssp2_pcat.markets a ;
in the above select sql I have created extra null column as empid
when I spool with tild dilimited I am not getting column name(empid) in spool file.
a.market_name||'~'||a.market_code||'~'||'''empid'
SSB ~25010~' empid
In the feed file it should be null. but the alias column is populted with empid
Can you please let me know what is wrong here?
Thanks,Try this one
SELECT DISTINCT a.market_name||'`'||a.market_code as empid from ssp2_pcat.markets a ; -
Sending Package as Parameter into SELECT Statement
Hi,
Im Facing a very typical Problem
I have a table with 5 columns...
Select EMPNO,ENAME,SAL,JOB,DEPTNO from emp;
Now my package actually returns 30 records
select * from TABLE(PKG_SEARCH.DOC_PROPERTY(29)
which actually returns 7 columns with 30 records...
My requirement is -
i want the package to be sent as column to the Select EMPNO,ENAME,SAL,JOB,DEPTNO from emp;
Is there any way that we can create bind variables for this scenario?
Plz Help
Regards,
~ Srii want the package to be sent as column to the Select EMPNO,ENAME,SAL,JOB,DEPTNO from emp;Why not
Select EMPNO,ENAME,SAL,JOB,DEPTNO, PKG_SEARCH.DOC_PROPERTY(29) doc_property from emp;? -
I am trying to understand how I can set up a series of pages for each of several subdomains such that when you view that web page it shows on the subdomain without the subdirectory name. Essentially I suppose I am wanting to point the subdomain at a folder...
For example I have my main site with the domain mysite.com.au and have 3 subdomains sub1.mysite.com.au, sub2.mysite.com.au etc... I want to then store the pages relating to each subdomain in their own subdirectories /dir01, /dir02 and /dir03 or otherwise named as something appropriate.
What want is to I have the page page1.htm in each of these subdirectories such that I can view the page with the url "http://sub1.mysite.com.au/page1.htm" and have the url displayed as such once loaded rather than having to enter http://mysite.com.au/dir01/page1.htm
Is this a simple or complicated process to put in place?Hello Julie.
Your junk filter appears to not be working properly. Try this first:
1. Go to Preferences > Junk Mail and disable junk mail filtering.
2. Quit Mail, then open it again.
3. Go to Preferences > Junk Mail, enable junk mail filtering, and configure it however you wish -- I recommend you to leave it at the default Automatic settings.
4. Reset the junk filter database (Preferences > Junk Mail > Reset). -
Querying many tables at once from a select statement for specific values
Hi all,
I'm very new to PL/SQL and have a daunting task ahead of me. I'm pretty sure our database normalization scheme is all out of whack, which I dont have the experience to fix yet, but this is the task ahead of me without getting to change or fix our structure:
in the universe has 1000+ tables.
need--> Some of those tables have fields that contain a value that has to be changed.
The only thing I have to go on is the column name will contain 'EMP'... but there is no specific naming convention for the column names.
When I search on:
select * from all_tab_columns where column_name like UPPER('%EMP%')
It returns 750 rows. (So 750 rows = 750 columns in 500 different tables (some tables have 2 or more columns in it))
tables names are random (table1, table2, etc).
columns names are random with EMP in it (column1,column2,etc).
I have 75 possible field values that I need to check each of those 750 columns for.
Maybe this is too messy, but I'm looking at subqueries, joins, arrays, cursors, etc, anything to minimize the amount of work I have to do.
I think this is too much to do a join with, but that seems to be what all the documentation is pointing me to.
can you point me to a simple example of what i could
write?
the logic i see it would be
run the select statement to grab the column names that meet EMP.
one at a time, search each column in the corresponding table for the 75 values.
return the results of rows for each column/table that meet one of the 75 unique values.
I'll have to also update each of the 75 values to (used to be values 1, 2, 3 ... to new values X1, X2, X3, etc.)
Any help at all would be very helpful,
aspiring pl/sql programmer but having a rough time of itI think you're looking to do something like the following pseudocode:
BEGIN
FOR tblrec IN (SELECT table_name, column_name
FROM all_tab_columns
WHERE column_name LIKE '%EMP%')
LOOP
FOR rec IN (SELECT ROWID
FROM tblrec.table_name
WHERE REGEXP_LIKE(tblrec.column_name, '(expr1|expr2|...)')
LOOP
DBMS_OUTPUT.PUT_LINE(
'Found expression on ROWID ' || rec.rowid
|| ' in column ' || tblrec.column_name
|| ' on table ' || tblrec.table_name);
END LOOP;
END LOOP;
END;
Maybe you are looking for
-
Get Guid of service order from Document nos !
Hello, Can anybody tell me the function module which will import Document nos of service order and return me the Guid of that document. Similarly i need function module which would accept document nos and return me the process type. I know its direct
-
Can XI Message be mapped to a flat file attachment in Mail adapter
Hi guys, I have a requirement, where I have ECC system seding a XI message to XI. Now XI has to convert this to a flat file may be tab delimited and send this as an attachment in email using receiver mail adapter. I want to avoid BPM and make it simp
-
Connecting firewire port to USB
My computer does not have a firewire port. How can I connect my video camera which has firewire port to the computer which has USB port? I would like to edit my videos.
-
After fully charging then using, it should show minutes used since last charge, it is not showing this information? the battery is showing fully green and an ap I have says 100% charged, so ???
-
About FM BAPI_BUPA_CENTRAL_CHANGE update
Hi all, I am entering an BP no in FM BAPI_BUPA_CENTRAL_CHANGE . The FM is Running but not showing any result in Return table and the data is not getting changed too.Why is it so? any ideas guys?. Please reply soon.