Cursor did not return data if using variables in the where clause
ENV: report builder 9.0.4.3.0, DB 10g, OS XP
table and data ctvctyp:
ctvctyp_code ctvctyp_code_pred
CO Z1
FE Z1
FUNCTION get_case_type(case_type VARCHAR2) RETURN VARCHAR2 IS
cursor type_cur is
select ctvctyp_code
from ctvctyp
where ctvctyp_code_pred = :P_case_type; -- if use 'Z1', it will return 'CO','FE'
-- but if 'Z1' is passed in as case_type, it returns null.
temp_type VARCHAR2(4);
return_type VARCHAR2(200);
counter NUMBER;
BEGIN
return_type := '';
counter := 0;
srw.message(20,'in case_type is '||case_type);
open type_cur;
LOOP
FETCH type_cur INTO temp_type;
EXIT WHEN type_cur%NOTFOUND;
counter := counter+1;
if temp_type is NULL then
srw.message(20,'temp type is null');
else
srw.message(20,temp_type);
end if;
if counter = 1 then
return_type := ''''||temp_type||'''';
else
return_type := return_type||','''||temp_type||'''';
end if;
END LOOP;
return return_type;
END;
In my p_casetype validation trigger:
function P_CaseTypeValidTrigger return boolean is
tempCaseType VARCHAR2(200);
return_type VARCHAR2(200);
begin
:P_CASETYPE := 'Z1'
return_type := get_case_type; --- I got null returned.
return (TRUE);
end;
But in sqlplus:
declare a bind variable :P_casetype := 'Z1';
select get_case_type from dual;
returns: 'FE','MI'
cursor type_cur is
select ctvctyp_code
from ctvctyp
where ctvctyp_code_pred = _{color:#0000ff}*:P_case_type;*_{color}Shouldn't be this :p_casetype instead of :p_case_type?
Similar Messages
-
Can I use SYSDATE in the WHERE clause to limit the date range of a query
Hi,
Basicaly the subject title(Can I use SYSDATE in the WHERE clause to limit the date range of a query) is my question.
Is this possible and if it is how can I use it. Do I need to join the table to DUAL?
Thanks in advance.
SteliosAs previous poster said, no data is null value, no value. If you want something, you have nvl function to replace null value by an other more significative value in your query.<br>
<br>
Nicolas. -
JSP, Data Web Bean, BC4J: Setting the where clause of a View Object at run time
Hi,
I am trying to develop a data web bean in which the where clause of a View Object will be set at run time and the results of the query then displayed.
My BC4J components are located in one project while the coding for the data web bean is in another project. I used the following code bu t it does not work. Could you please let me know what I am doing wrong?
public void populateOSTable(int P_EmpId)
String m_whereString = "EmpView.EMP_ID = " + P_EmpId;
String m_OrderBy = "EmpView.EMP_NAME";
oracle.jbo.ApplicationModule appModule = null;
ViewObject vo = appModule.findApplicationModule("EMPBC.EMPAppModule").findViewObject("EMPBC.EMPView");
vo.setWhereClause(m_whereString);
vo.setOrderByClause(m_OrderBy);
vo.executeQuery();
vo.next();
String empName numAttrs = vo.getAttribute(EmpName);
System.out.println(empName);
Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
Here is how I have usually done mine:
1. In the JSP, use a RowsetNavigator bean to set the where clause and execute the query.
2. Use a custom web bean to process the results of the query (print to HTML).
for example:
<jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
<%
// get the parameter from the find form
String p = request.getParameter("p");
String s = request.getParameter("s");
// store the information for reference later
session.putValue("p", p);
session.putValue("s", s);
// initialize the app module and view object
rsn.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
// set the where clause string
String theclause = "presname = '" + p + "' AND slideno=" + s;
// set the where clause for the VO
rsn.getRowSet().getViewObject().setWhereClause(theclause);
rsn.getRowSet().getViewObject().executeQuery();
rsn.getRowSet().first();
%>
</jsp:useBean>
<jsp:useBean class="wt_bc.walkthruBean" id="wtb" scope="request" >
<%
// initialize the app module and VO
wtb.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
wtb.render();
%>
In this case, the render method of my custom web bean mostly gets some session variables, and prints various content depending on the session variable values.
Hope this helps.
</jsp:useBean><HR></BLOCKQUOTE>
Laura can you give the code of your walkthru bean? i wna't to initialize a viewobject, set the where clause and give that viewobject back to initialize my navigatorbar.
Nathalie
null -
Query Stripping not working properly when using variable in the report
We have issue with WEBI document that have query stripping enable.
Once the query stripping enabled there is no data return in the report.
We have investigate on the problem, the query stripping function are notable to retrieve objects that indirectly used in the report
as we have
many variable in the reports.
Ex.
Var1 = object1 + object2
Var2 = Object3 + Object4
Var3 = Var1 + Var2
Var4 = Object1 + Object2 + Object3 + Object4
If we use only Var3 in the report, the object1,2,3,and 4 will not be
retrieve.
But if we are using Var4 in the report, the object1,2,3,and 4 will be
retrieve properly.
Please let me know is it a by-design behavior, if yes please share points on itHi Amit,
Thank you for response, however i already had alook on that VIdeo and it tells us about the basic enabling of query stripping.
But my question is when we have a Variable in a report which is dependent on the other two variables it gives me #error so is it by design or not.
Regards,
Abhinav -
Using ROWID in the WHERE clause of a SELECT statement
hi all,
my team is trying to select a value from a table using the rowid as the selection criterion
e.g. select column_name from table_name where rowid > 'AAA112BBBCCC12A'
this query does not appear to return accurate results e.g. it return rows instead of two. my questions are:
1. is this a legitimate approach?
2. should we convert the row id to varchar2? if so how should this be done?
thanks!SQL> select rowid,ename
2 from emp;
ROWID ENAME
AAAs8KAA+AAAVXCAAA KING
AAAs8KAA+AAAVXCAAB BLAKE
AAAs8KAA+AAAVXCAAC CLARK
AAAs8KAA+AAAVXCAAD JONES
AAAs8KAA+AAAVXCAAE SCOTT
AAAs8KAA+AAAVXCAAF FORD
AAAs8KAA+AAAVXCAAG SMITH
AAAs8KAA+AAAVXCAAH ALLEN
AAAs8KAA+AAAVXCAAI WARD
AAAs8KAA+AAAVXCAAJ MARTIN
AAAs8KAA+AAAVXCAAK TURNER
AAAs8KAA+AAAVXCAAL ADAMS
AAAs8KAA+AAAVXCAAM JAMES
AAAs8KAA+AAAVXCAAN MILLER
AAAs8KAA+AAAVXCAAO erwer
15 rows selected.
SQL> select ename from emp where rowid = 'AAAs8KAA+AAAVXCAAH';
ENAME
ALLEN
SQL> select ename from emp where rowid > 'AAAs8KAA+AAAVXCAAH';
ENAME
WARD
MARTIN
TURNER
ADAMS
JAMES
MILLER
erwer
7 rows selected.1) using rowid to access a record is the quickest way so it is legitimate
however using > has no real purpose as you point out you cannot get any meaningful results returned.
2) No real need to convert however beware storing values in tables as Oracle does not guarantee to preserve the format in different versions so upgrading from 9i to 10g would invalidate your data. -
Two variables in the where clause
DECLARE @Id VARCHAR(100)
DECLARE @NO VARCHAR(100)
SET @Id = 'IN'
SET @No = 10
SELECT *
FROM DBName.sys.indexes I
JOIN DBName.sys.tables T ON T.Object_id = I.Object_id
WHERE T.name like '%' +@Id + '_' +@NO+'%'
I need something like the above query that works.Question is vague
Cant understand what you're really looking for as posted query has no obvious errors
Can you give some sample data and explain what you're trying to get as output
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
External Content Typ: "Connection manager did not return valid connection."
Hi,
I created an external content typ in the sharepoint designer which takes my custom WCF Service as a data source. I sucessfully added all my required operations and created a new list based on the new content typ. At first I had a security issue which I got
resolved by editing my BDC configuration in the Central Administration. Now I face a new issue. When I open my external list the BDC Service gives me the following error message:
"Connection manager did not return valid connection."
Has someone a solution for this kind of message?
Thanks,
EricHi,
I got the same error "Connection manager did not return valid connection.". In the error log it shows
09/17/2010 12:21:35.28 w3wp.exe (0x13FC) 0x0F60 Business Connectivity Services Business Data
a5t8 Medium Chose 'PassThrough' auth mode cb34d6ff-663a-4872-9022-21782a7be122
09/17/2010 12:21:35.28 w3wp.exe (0x13FC) 0x0F60 Business Connectivity Services Business Data
a5uo Medium Initialized WcfSystemUtility for LobSystemInstance with Id '144'. cb34d6ff-663a-4872-9022-21782a7be122
09/17/2010 12:21:35.28 w3wp.exe (0x13FC) 0x0F60 Business Connectivity Services Business Data
a5up Medium Wcf Service AuthN Mode: PassThrough cb34d6ff-663a-4872-9022-21782a7be122
09/17/2010 12:21:35.28 w3wp.exe (0x13FC) 0x0F60 Business Connectivity Services Business Data
f8dk Medium Checking for current connection to SystemInstance: NewCustomer cb34d6ff-663a-4872-9022-21782a7be122
09/17/2010 12:21:35.28 w3wp.exe (0x13FC) 0x0F60 Business Connectivity Services Business Data
a5s9 Medium Creating ClientBase object with type : BCSServiceProxy.WCFCustomerClient cb34d6ff-663a-4872-9022-21782a7be122
09/17/2010 12:21:35.29 w3wp.exe (0x13FC) 0x0F60 Business Connectivity Services Business Data
a5tz Unexpected System.MissingMethodException: Method not found: 'Void Microsoft.BusinessData.SystemSpecific.Wcf.IBdcClientBase.set_ActAs(Boolean)'. at Microsoft.SharePoint.BusinessData.SystemSpecific.Wcf.WcfConnectionManager.ConfigureCredentials(Type
clientBaseType, Object clientBase) at Microsoft.SharePoint.BusinessData.SystemSpecific.Wcf.WcfConnectionManager.CreateClientBase() at Microsoft.SharePoint.BusinessData.SystemSpecific.Wcf.WcfConnectionManager.GetConnection()
at Microsoft.SharePoint.BusinessData.SystemSpecific.Wcf.WcfSystemUtility.ExecuteStatic(IMethodInstance methodInstance, ILobSystemInstance lobSystemInstance, Object[] args, IExecutionContext context) cb34d6ff-663a-4872-9022-21782a7be122
Can you help me on this?
Thanks in advance
Thybu -
CAN I PASS A TABLE NAME AS A VARIABLE IN THE FROM CLAUSE?
For some reason, I am trying to use a variable name containing the actual table name in the from clause and it won't allow me. I keep getting the error saying I need to declare the variable I'm using eventhough I've used it in another statement that is not the FROM clause.
Example
SELECT count(col1), sum(col2)
FROM v_table_name;
v_table_name was declared as:
v_tablename VARCHAR2(20);
v_tablename := real_table_name;
Is it not allowed to use variables in the FROM clause or am I missing something here?You can use the Forms "From Clause Query" as the datasource for the data block. Then you can change the QUERY_DATA_SOURCE_NAME using set_block_property, so you can use any SQL statement you like. Of course you must name/alias the columns in a consistent manner so that the number of database items on the block matches those being queried.
-
Use "ListContains' in a WHERE clause
I believe I have a syntax problem and could you some help.
First, I have a field in an Access DB called 'degree" that conatins
a list of numbers. This list can be any combination of the numbers
4 through 32. On my search page I have a selection box in a form to
select a value of the degree to search for. The variable passed
from the form is called "degreeValue". I have a component that lets
me build my WHERE clause using several seach criteria. It functions
perfectly prior to adding the search for "degree". I attempted to
use "ListContains" in the WHERE clause using "degree" as the name
of my list and "degreeValue" as my substring to search for. The
error I get says that "variable degree is undefined". I am
attaching the full code of the compoanent so you can see it. Again,
it works if you take out the subclause build for "degree".I understand what you are saying and in other situations have
done my tables that way. I didn't this time because this is one of
those... "add it later" kind of things. Yes, the field does look
like "1,2,3,4,etc.." The inventory a couple thousand items each
with a number (catno). As you obviously noticed the inventory table
houses most of the data for the items. The "degree" field in the
past was only used to populate a series of checkboxes and was not
searchable, thus a list was used.
With a possibility of 29 values for "degree" and a
possiblility of over 2,000 inventory items you can see a newly
created table might become quite large. It would be nice if I could
use the current structure.
You are absolutely correct saying the design should be
different. Thank you for your quick reply and good information. -
Using CLOB datatypes in WHERE clause
Hi All,
I have a table with two columns as CLOB datatype. I'm using Oracle 8i Enterprise Edition. I can do a query, insert, update and even delete the data in the CLOB field using Oracle's SQL Plus.
What I want is to do a search on those fields.. that is include that field in a WHERE clause. I'm using this datatype to store large number of data.
I'd like to see this query working...
SELECT * FROM MyTable WHERE CLOBFLD LIKE 'Something...';
Now this query doesn't work. It returns: 'Inconsistent datatype' near the word CLOBFLD.
Please Help me out.
Regards,
Gopi
nullI presume you want to query based on the contents of the CLOB, right ? If that is true, then you have to create a text index, using Oracle Context and then use "Contains" in the where clause to query. Hope this helps.
-
Data Services Designer Query tranform dynamic where clause or another way
I have an XML source that has 5 fields. These fields are used to query 4 different SQL table data sources and do an AND inthe where clause of a query transform. Works well if all 5 fields in the xml have data. If one (or more) are blank, then it runs the where checking for blank matches and gives no results. What I want to do is if a field is blank, do not use it in the where clause. Could this be an outer join setup? Issue is that if there is a PhoneNumber input, then to be considered a result, there must be a PhoneNumber match on potential result records...
I have an XML source that has 5 fields. These fields are used to query 4 different SQL table data sources and do an AND inthe where clause of a query transform. Works well if all 5 fields in the xml have data. If one (or more) are blank, then it runs the where checking for blank matches and gives no results. What I want to do is if a field is blank, do not use it in the where clause. Could this be an outer join setup? Issue is that if there is a PhoneNumber input, then to be considered a result, there must be a PhoneNumber match on potential result records...
-
Boot loader did not return any data.
Hi,
i have installed the Oracle VM Server and Oracle VM Manager in two different machines. I'm using the VM Manager to create the Virtual Machines(guest). I followed all the steps given in the Oracle VM Manager User guide 2.2. I'm using the RHEL5 as the OS for the guest machine. I receive an error saying 'Boot loader did not return any data.'. The vm.cfg file has got created in the path /OVS/running_pool/12_VM1. The contents of the vm.cfg file are as below
bootloader = '/usr/bin/pygrub'
disk = ['file:/var/ovs/mount/616CC4FA976D4352B1630FFCE835FEC5/running_pool/14_VM1/System.img,xvda,w']
keymap = 'en-us'
memory = '1024'
name = '14_VM1'
on_crash = 'restart'
on_reboot = 'restart'
uuid = '3a925bc9-1555-b5bb-b0f0-c5958db65468'
vcpus = 1
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=vm123']
vif = ['mac=00:16:3E:02:8B:64, bridge=xenbr0']
Can any one help out in this ASAP.
Thanks in Advance.re..
sorry but did you installed guest OS or not ?
Did you install from image, from dvd ...?
If yes try start youre vm from server terminal
#>xm create -c vm. cfg
*T -
Avoid JDBC sender error: Execute statement did not return a result set
Hi!
My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
I do not see how to change the stored procedure to avoid this error.
Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
Thanks for any input!
Regards,
Oeystein EmhjellenHi Oeystein Emhjellen.
The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
Like a SELECT Statement:
If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
Ask to your database team.
I hope it helps you.
Bruno. -
Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?
hi All:
I have a problem in SQL with CURSOR.
The data is as the attachments.
Here is the SQL statement as follow:
SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
FROM F3102 X
WHERE X.IGDOCO=A.WADOCO
AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
WHERE A.WADOCO='10004'
The statement above returns records as follow:
WADC WADOCO IGCOST DETAIL
WO 10004 A1 CURSOR STATEMENT : 4
CURSOR STATEMENT : 4
IGLITM
1KV90CPG2
1KV90CPG2
1KV90CPG2
But, after I add one statement in the subquery, there is no record returned from CURSOR.
Here is the SQL statement:
SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
FROM F3102 X
WHERE X.IGDOCO=A.WADOCO
AND X.IGCOST=B.IGCOST
AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
WHERE A.WADOCO='10004'
The statement above returns records as follow:
WADC WADOCO IGCOST DETAIL
WO 10004 A1 CURSOR STATEMENT : 4
CURSOR STATEMENT : 4
no rows selected
Why the CURSOR did not work?
The database version is Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.
F3102 DATA:
IGDOCO IGDCTO IGLITM IGCOST
10004 WO 1KV90CPG2 A1
10004 WO 1KV90CPG2 B1
10004 WO 1KV90CPG2 C3
10004 WO 1KV90CPG2 D1
F4801 DATA:
WADCTO WADOCO
WO 10004
Edited by: user2319139 on 2010/3/2 上午 1:17
Edited by: user2319139 on 2010/3/2 上午 1:20Why this structure and not a join?
The cursor() function returns a cursor handle that needs to be processed - in other words, the client needs to fetch data from it. The Oracle® Database SQL Reference+ (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions005.htm#i1035107) describes it as being equivalent to a ref cursor handle.
Thus why are you creating ref cursor handles as a column in a SQL projection - where each row will have a "+nested+" ref cursor handle to process. What problem are you attempting to hack solve this way? -
The provider did not return a ProviderManifest instance. Metadata is invali
I am using VS2010 SP1
Latest version of ODP.net downloaded for 32 bilt.
I am getting the following error message when I try to build my project
Error 168: The provider did not return a ProviderManifest instance. FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.SUPPLIER_NAME.Column.0 Metadata is invalid
My app.config entry looks as follows:
*<oracle.dataaccess.client>*
*<settings>*
*<add name="FSDEVTL.GET_SUPPLIERS.RefCursor.SUPP_LIST" value="implicitRefCursor bindinfo='mode=Output'" />*
*<add name="FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.SUPPLIER_NAME.Column.1" value="implicitRefCursor metadata='ColumnName=SUPPLIER_NAME;BaseColumnName=SUPPLIER_NAME;BaseSchemaName=FSDEVTL;BaseTableName=A_SUPPLIER;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />*
*</settings>*
*</oracle.dataaccess.client>*
My stoerd procedure looks as follows:
PROCEDURE "GET_SUPPLIERS" (
"SUPP_LIST" OUT SYS_REFCURSOR) IS
BEGIN
OPEN SUPP_LIST FOR
SELECT
SUPPLIER_NAME
FROM
A_SUPPLIER ;
END;
Please assist me.
Thanks
Edited by: 923484 on Mar 26, 2012 2:06 PMAlso it should start from Column.0. But you put:
<add name="FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.SUPPLIER_NAME.Column.1" value="implicitRefCursor
*With the following in your config file, do you still have the issue?*
<add name="FSDEVTL.GET_SUPPLIERS.RefCursor.SUPP_LIST" value="implicitRefCursor bindinfo='mode=Output'" />
<add name="FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.*SUPP_LIST*.Column.*0*" value="implicitRefCursor metadata='ColumnName=SUPPLIER_NAME;BaseColumnName=SUPPLIER_NAME;BaseSchemaName=FSDEVTL;BaseTableName=A_SUPPLIER;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
Edited by: shsu on Oct 10, 2012 3:30 PM
Maybe you are looking for
-
Error in updating ALV field catalog in selection tool for Planning Book
Hi , I am Implementing BADI '/SAPAPO/SDP_SELECTOR' to upload Custom Fields Data in Planning Book Selection Window under APO Location Product. These Custom Fields are maintained in Custom Table.So from Table whatever Custom Fields are availabe all th
-
I cannot open Keynote and Pages in iPhone/iPad iOS 7
After updating to iOS 7 and iWork for iOS, I'm no loger able to use iWork for iOS when iCloud is turned on. I've two apple accounts, one for Mexico store and another one for US store. A couple of yeard ago I purchased Numbers for iphone/ipad using MX
-
Configuring phone 5S and get strange Apple ID
Trying to configure my phone, selected my latest iCloud update from last night and now pops up a complete different hotmail address with the question: Enter the apple ID for .... other hotmail cloud than mine, and I need to fill in my password. If I
-
Officejet 4260 Cant get a claim code
Officejet 4260 Cant get a claim code, which I need to set up ePrint, enrol for ink deliveries etc. When I press the wireless connection button on the control panel, nothing happens..so I can go no further. I have printed off a Wireless test results w
-
Where does Teststand put the result from the calling module ? I've written a number of steps in TS 3.1 using the LV7.1 prototype adapter. All my step valuations are 0 ! I assume when I create the "Specify a module step" I have to "wire" the resulting