SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


No data found error


No data found error

Author
Message
corderoj
corderoj
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 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???
Welsh Corgi
Welsh Corgi
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28412 Visits: 4895
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/
Jo Pattyn
Jo Pattyn
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7545 Visits: 10035
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
helensingleton84
helensingleton84
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 Visits: 1
OPENQUERY on just the Oracle table.
Swashbuckler
Swashbuckler
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 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%''
dweil
dweil
Mr or Mrs. 500
Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)Mr or Mrs. 500 (572 reputation)

Group: General Forum Members
Points: 572 Visits: 3289
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.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search