Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] OLE DB errors when using CTE's on SQL Server + SOLUTION

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SHARING] OLE DB errors when using CTE's on SQL Server + SOLUTION
 Login/Join
 
Virtuoso
posted
This is a bit of a "note to self", but I've run into this error a couple of times now and the solution is not obvious from the error message. Searching the forums on the error also didn't provide an immediate answer. Until now Smiler

If you use a CTE (Common Table Expression), such as:
ENGINE SQLMSS SET DEFAULT_CONNECTION &CONNECTION
SQL SQLMSS PREPARE SQLOUT FOR
WITH cte1 AS (
   SELECT 1 AS WHICH, A, B, C FROM TABLE1 WHERE C IS NOT NULL
   UNION
   SELECT 2 AS WHICH, A, B, 'dummy' AS C FROM TABLE1 WHERE C IS NULL
)
SELECT WHICH, A, B, C FROM cte1
ORDER BY C
;
END

TABLE FILE SQLOUT
PRINT *
END


You may get an error:
 (FOC1400) SQLCODE IS -1 (HEX: FFFFFFFF)
 : Microsoft SQL Native Client: [] Multiple-step OLE DB operation generated
 :  errors. Check each OLE DB status value, if available. No work was done.
 L    (FOC1406) SQL OPEN CURSOR ERROR.  : SQLOUT


This is NOT (necessarily) because there's any error in your query. I was scratching my head after executing this query just fine from another (Java-based) SQL client, until I found an old post (by myself, even!) that contained the solution - but that was about a different topic.

The solution: You need to add below line to your ENGINE initialisation code to make WebFOCUS perform the query entirely in the SQL client (or something):
ENGINE SQLMSS SET CURSORS CLIENT



So it becomes:
ENGINE SQLMSS SET CURSORS CLIENT
ENGINE SQLMSS SET DEFAULT_CONNECTION &CONNECTION
SQL SQLMSS PREPARE SQLOUT FOR
WITH cte1 AS (...)


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
I was looking for help on this and was glad to find this. Later on, I found I could change this by default under the Server Admin Adapter Connection Settings. I changed Controlling Session Parameters>CURSORS to 'CLIENT' (nothing was previously selected).




WebFOCUS 8004
Windows Server 2008 R2 Standard 64-bit
All Outputs
 
Posts: 14 | Registered: December 21, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] OLE DB errors when using CTE's on SQL Server + SOLUTION

Copyright © 1996-2020 Information Builders