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
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 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
SSC Guru
SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)

Group: General Forum Members
Points: 69326 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
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17503 Visits: 10340
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
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 1
OPENQUERY on just the Oracle table.
Swashbuckler
Swashbuckler
SSC Journeyman
SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)

Group: General Forum Members
Points: 98 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
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1286 Visits: 3403
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