ODBCOutput with select statement

Post Reply
tmccollum
Posts: 7
Joined: Thu Mar 05, 2020 4:03 pm
OLAP Product: tm1
Version: 10.2.2
Excel Version: Office 2010 32 bit

ODBCOutput with select statement

Post by tmccollum »

I've used ODBCOutput to do dml and ddl on oracle tables but is this possible?

ODBCOutput(vConnection, 'select 12345 into %vNumber% from dual');

The reason is I'd like to use this as like a post-query against a sql based ODBC data source in a process. I've read all over the place and seen numerous instances for insert, update, delete. I've done commits and truncates as well. The select works without the into clause. Is there a way to make the into clause work?

As written it doesn't compile with variable not defined error. If I define the variable and put the query into the expand function it parses the variable to a literal.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: ODBCOutput with select statement

Post by tomok »

tmccollum wrote: Fri Mar 06, 2020 3:13 pm I've used ODBCOutput to do dml and ddl on oracle tables but is this possible?

ODBCOutput(vConnection, 'select 12345 into %vNumber% from dual');

The reason is I'd like to use this as like a post-query against a sql based ODBC data source in a process. I've read all over the place and seen numerous instances for insert, update, delete. I've done commits and truncates as well. The select works without the into clause. Is there a way to make the into clause work?

As written it doesn't compile with variable not defined error. If I define the variable and put the query into the expand function it parses the variable to a literal.
TM1 would have no insight into whether or not a particular SQL command would work or not when compiling. You could literally put any valid string as the second parameter and it would compile. I think your issue is the syntax for the second paramter. As written it is literally a string that says

Code: Select all

select 12345 into %vNumber% from dual
I'm guessing you really want to insert the value in the variable vNumber into the table but your code is going to insert the text %vNumber% instead. Make sure your second paramter evaluates into the string you want.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Post Reply