Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

No data found error Expand / Collapse
Author
Message
Posted Tuesday, March 26, 2013 8:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:17 AM
Points: 1, Visits: 9
I also had code working perfectly yesterday and errors today. I have a view pulling data from oracle with an openquery, and a stored procedure using the view with SQL tables. The SP works without the where clause, but errors with "No data found" when the where clause is included. I ended up dumping the view into a temp table first, then using the temp table in the stored procedure and that works. It looks like a problem with date formatting, but who knows why it worked yesterday and not today???
Post #1435498
Posted Tuesday, March 26, 2013 8:16 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Saturday, August 20, 2016 3:49 AM
Points: 5,002, Visits: 4,797
You should not get an error but you should include an exception Handler to Include WHEN NO DATA FOUND, perform an action.

Take you select statement and look at what is in the WEHRE Clause.

Examine the Data closely and determine what in the Where Clause is causing no data to be returned.



For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Post #1435514
Posted Sunday, June 15, 2014 12:37 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 7:32 AM
Points: 1,528, Visits: 9,525
For newbieuser: convert '18/01/2009' to a proper datetype instead of relying on the occasional dateformat of the server. By using convert?
For penny: have you checked the distiributed transaction coordinator security? (articles on the web)
Is there an Oracle MTS (multithreadedtransaction)-service runningn, so MS DTC can communicate with it
Post #1580946
Posted Sunday, February 8, 2015 9:14 PM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, February 8, 2015 9:19 PM
Points: 1, Visits: 1
OPENQUERY on just the Oracle table.
Post #1658693
Posted Monday, May 23, 2016 10:34 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 9, 2016 8:09 PM
Points: 8, Visits: 115
newbieuser (5/10/2011)
I tried the sql using openquery but I'm not getting it right..

SELECT  * from OPENQUERY(LS, 'SELECT * FROM  U.ABO,
U.LED_ID,
U.PROJECT_NO,
T.WORDC,
P.CHECKC,
P.PIN_NO,
FROM unit1 U
INNER JOIN unit2 L
ON U.ABO = L.ABO
INNER JOIN LS..USER2.UNIT3 P
ON L.CT_ID = P.CT_ID
INNER JOIN unit4 T
ON U.PCT = T.ACT
AND U.FJT_TYP = T.FJT_TYP
WHERE U.ABO like 'LE%'
--AND U.CREATE_DT = TO_DATE('18/01/2009' ,'DD/MM/YYYY')
AND U.CREATE_DT ='2009-01-18'
ORDER BY U.ABO, U.LED_ID')

Getting lot of syntax errors.. can you help me please. Also, since the query works if I remove either the order by clause or one of the where condition, could it be something to do with the ORAOLEDB we use in ODBC? like a setting to be changed?
Thanks.


Not sure what your errors are, but when using OPENQUERY you need to escape your quotes by double (single) quoting. E.g. WHERE U.ABO like ''LE%''
Post #1789080
Posted Wednesday, May 25, 2016 6:00 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 2:08 PM
Points: 139, Visits: 3,032
Can you try running the query in SQLPLUS to resolve the Oracle syntax issues and then try openquery.
Sometimes the driver can send back bogus messages that might be obvious in the oracle native environment.



Post #1789577
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse