
While DSNs are a great way to get consistent behavior from one or more applications, they do require the step of creating the DSN. Ultimately, the application might override most any of the values you specify in a DSN so they aren't strict controls on the settings. A DSN or data source Name can be thought of as a saved collection of default values for an ODBC connection to use.

In the previous example, a DSN was selected to define the connection. With this dialog you can modify the query, change the query name, and use the 'Advanced Editor' function (near the upper left) to edit the SQL statement. Selecting the EDIT option opens the dialog box shown in Fig. If you close the 'Queries & Connections' pane, you can reopen it using the 'Queries & Connections' item on the Data ribbon. Note, there is also a refresh icon to the right of the query name and clicking it refreshes the data in spreadsheet. The options in this window provide functions to edit the query and do several other things that are beyond the scope of this technote. If you hover your mouse over the spreadsheet icon just to the left of the query name (it was given a default name of Query1), you get a pop-up window as shown in Fig. Note the 'Queries & Connections' item to the right of the data. Press 'Load' and it loads the data into the spreadsheet and saves the query in it as shown in Fig. 1b.Ĭlick OK and it makes an ODBC connection, run the query and display the results in a table as shown in Fig. Select the data source to connect to Db2 on IBM i and expand the 'Advanced options' twistie and type in your select statement in the 'SQL statement (optional)' section as shown in Fig. Start by opening a blank worksheet and selecting the Data ribbon, then 'Get Data', 'From Other Sources' and select 'From ODBC' as shown in Fig. In the following examples, Excel 2016 was used but the features exist in older versions of Excel as well. This technote demonstrates two different ways to retrieve data by using an ODBC data source (DSN) which was previously created and finally by using a DSN-less connection. Excel features a Data ribbon in which you can select different ways to import data into Excel. Parameters 1 and 3 are reference cursor parameters and parameters 2 and 4 are character strings.While the data transfer tools provided by IBM can certainly retrieve data for use in Excel, they are not the easiest nor the most functional way to do that. For example, assume procedure Example2 is defined to have four parameters. The PL/SQL reference cursor parameters are omitted when calling the procedure.
#ODBC EXCEL SYNTAX HOW TO#
The following code sample identifies how to call the procedure or function without a package and within a package. Native PL/SQL is not supported through ODBC. You must use the ODBC syntax for calling stored procedures. The following information describes how to use reference cursors to enable result sets through ODBC: Oracle reference cursors, also known as result sets, enable an application to retrieve data using stored procedures and stored functions. NLS implies that the Globalization Support numeric settings are to be used (to determine the decimal and group separator). T implies that SQL_TIMESTAMP is to be bound as Oracle DATE.į implies that SQL_TIMESTAMP is to be bound as Oracle TIMESTAMP.


T implies that SQLDescribeParam is to be disabled.į implies that SQLDescribeParam is to be enabled. T implies that the default value of SQL_ATTR_METADATA_ID is SQL_TRUE.į implies that the default value of SQL_ATTR_METADATA_ID is SQL_FALSE. Owner implies that the name of the owner is to be used. T implies Force SQL_WCHAR is to be enabled.į implies Force SQL_WCHAR is to be disabled.ĭefault implies that the default value is to be used.ĭatabase implies that the Database Name is to be used. User-supplied numeric value (specify a value in bytes of 0 or greater).The default is 60,000 bytes. This is ODBC version 7 behavior.ĪllSuccessful implies commit all successful statements. UpToFirstFailure implies commit up to first failing statement. IfAllSuccessful implies commit only if all statements are successful (old behavior). T implies that close cursor is to be enabled.į implies that close cursor is to be disabled. T implies that query timeout is to be enabled.į implies that query timeout is to be disabled. T implies that result sets are to be enabled.į implies that result sets are to be disabled. T implies that thread safety is to be enabledį implies that thread safety is to be disabled
