<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Basic Questions using oracle SQL and JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33711#M19997</link>
    <description>Whoops, somehow missed that above.  You did.  Are  you sure you have write privileges to this database?</description>
    <pubDate>Thu, 15 Dec 2016 13:55:56 GMT</pubDate>
    <dc:creator>briancorcoran</dc:creator>
    <dc:date>2016-12-15T13:55:56Z</dc:date>
    <item>
      <title>Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33662#M19967</link>
      <description>&lt;P&gt;I'm currently doing some testing to see how well JMP 13 and Oracle (12c) can work together. &amp;nbsp;My end-game is to import oracle data using SQL queries into JMP, run analysis on the data, and then return the data back to the Oracle database while dropping the original table. &amp;nbsp;I've been able to sucessfully bring data into JMP, but I'm having issues with saving the data table back to oracle. Here's what I have so far and what I think&amp;nbsp;the drop the table command should be (currently commented out):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;constring = ("DSN=***; UID=****; PWD=****);&lt;/P&gt;&lt;P&gt;dt1 = Open Database(constring,"select * from test1","test1");&lt;/P&gt;&lt;P&gt;dt1 &amp;lt;&amp;lt; save database(constring,"test2");&lt;/P&gt;&lt;P&gt;//open database (constring,"Drop table test1");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this the "test1" table pops up with the correct data in it, but the "save database" errors out with the following error:&lt;/P&gt;&lt;P&gt;Send Expects Scriptable Object in access or evaluation of 'Send' , dt1 &amp;lt;&amp;lt; /*###*/save database( constring, "test2" ) /*###*/&lt;/P&gt;&lt;P&gt;In the following script, error marked by /*###*/&lt;BR /&gt;dt1 &amp;lt;&amp;lt; /*###*/save database( constring, "test2" ) /*###*/&lt;BR /&gt;{}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been using this document (&lt;A href="https://www.jmp.com/content/dam/jmp/documents/en/white-papers/wp-jmp-odbc-102427.pdf" target="_blank"&gt;https://www.jmp.com/content/dam/jmp/documents/en/white-papers/wp-jmp-odbc-102427.pdf&lt;/A&gt;) as my primary reference and I think it looks the same as the example, but something is clearly off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong with the "save database" function and will the drop table command work?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 17:40:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33662#M19967</guid>
      <dc:creator>beastwood</dc:creator>
      <dc:date>2016-12-14T17:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33680#M19977</link>
      <description>&lt;P&gt;Hey, beastwood,&lt;/P&gt;
&lt;P&gt;Well, I'm puzzled, because I mimicked your script exactly on JMP 13 with Oracle and it worked fine, including the DROP TABLE:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;connstr = "DSN=Oracle Striper Replacement;UID=***;PWD=***;DBQ=EXADAT12C ;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;";

dt1 = Open Database(
	connstr,
	"SELECT * FROM \!"SQBTEST\!".\!"BigTest3\!"",
);

dt1 &amp;lt;&amp;lt; Save Database(connstr, "SQBTEST.BigTest4");

Open Database(
	connstr,
	"DROP TABLE \!"SQBTEST\!".\!"BigTest3\!""
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only time I got the "Send expects scriptable object" message was one time when I had the wrong table name in the Open Database function and so the open failed.&lt;/P&gt;
&lt;P&gt;Maybe throw a:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;show(dt1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in between the Open Database and Save Database calls and make sure dt1 looks right. It should look something like this in the JMP Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 = DataTable("SQL Results 3");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 20:22:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33680#M19977</guid>
      <dc:creator>Eric_Hill</dc:creator>
      <dc:date>2016-12-14T20:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33686#M19983</link>
      <description>&lt;P&gt;I changed it around a little bit, trying to dot my i's and cross my t's. &amp;nbsp;Here's my jsl code and the log output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;JSL Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;constring = ("DSN=***; UID=***; PWD=***");&lt;/P&gt;&lt;P&gt;dt1 = Open Database(constring,"SELECT * FROM UID.TEST", "TEST1");&lt;/P&gt;&lt;P&gt;show(dt1);&lt;/P&gt;&lt;P&gt;dt1 &amp;lt;&amp;lt; save database(constring,"UID.TEST1");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Log output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Database Connection Information:&lt;BR /&gt;DSN=***; UID=***;&lt;BR /&gt;dt1 = DataTable("TEST1");&lt;BR /&gt;Database Connection Information:&lt;BR /&gt;DSN=***; UID=***;&lt;BR /&gt;Scriptable[]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nothing is too small at this point, if something looks fishy let me know. Otherwise, if you can run it, I'm stuck with wondering if it's my ODBC somehow.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 21:24:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33686#M19983</guid>
      <dc:creator>beastwood</dc:creator>
      <dc:date>2016-12-14T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33710#M19996</link>
      <description>&lt;P&gt;Did you specify the schema name with the name of the table to save? &amp;nbsp;An example:&lt;BR /&gt;&lt;BR /&gt;dt &amp;lt;&amp;lt; Save Database("DSN=MyConnectionInfo", "SchemaName.BigClass");&lt;BR /&gt;&lt;BR /&gt;Brian Corcoran&lt;/P&gt;
&lt;P&gt;JMP Development&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:55:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33710#M19996</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2016-12-15T13:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33711#M19997</link>
      <description>Whoops, somehow missed that above.  You did.  Are  you sure you have write privileges to this database?</description>
      <pubDate>Thu, 15 Dec 2016 13:55:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33711#M19997</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2016-12-15T13:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33715#M20000</link>
      <description>&lt;P&gt;You could try inserting a Wait(0) statement after Open Database:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 = Open Database(...);
Wait(0);
dt1 &amp;lt;&amp;lt; Save Database(...);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have my doubts that this will help, because the show(dt1) shows that it knows it is a data table.&lt;/P&gt;
&lt;P&gt;If you simply open&amp;nbsp;a sample data table, say &lt;STRONG&gt;Big Class&lt;/STRONG&gt;,&amp;nbsp;interactively and then, from script, do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Data Table() &amp;lt;&amp;lt; Save Database(...);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does that work? &amp;nbsp;That would establish that you have write permission.&lt;/P&gt;
&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:18:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33715#M20000</guid>
      <dc:creator>Eric_Hill</dc:creator>
      <dc:date>2016-12-15T14:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33724#M20009</link>
      <description>&lt;P&gt;Sadly that didn't work. &amp;nbsp;I created the tables I'm trying to reference in my own schema. &amp;nbsp;Is it possible that the ODBC connection can have select access, but not write access? (Sorry I'm not really familiar with how the ODBC connection actually works.)&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:17:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33724#M20009</guid>
      <dc:creator>beastwood</dc:creator>
      <dc:date>2016-12-15T16:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33731#M20014</link>
      <description>It's actually very common to only be able to query the database, but not modify the contents.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Dec 2016 19:02:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33731#M20014</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2016-12-15T19:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33774#M20023</link>
      <description>&lt;P&gt;Thanks for the information and help everyone. &amp;nbsp;It looks like I'll need to talk to my DBA and see if there is some option will will give me write access over my ODBC connection. &amp;nbsp;Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 17:27:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33774#M20023</guid>
      <dc:creator>beastwood</dc:creator>
      <dc:date>2016-12-16T17:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33785#M20025</link>
      <description>&lt;P&gt;You need the proper grants to be able to create tables in that particular schema. &amp;nbsp;If that's not possible perhaps this approach would work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have your DBA create the second table and give you read, write, delete privs on it.&lt;/P&gt;
&lt;P&gt;Use &lt;STRONG&gt;DELETE FROM&lt;/STRONG&gt; to remove records, &lt;STRONG&gt;UPDATE&lt;/STRONG&gt; to modify existing records, or &lt;STRONG&gt;INSERT INTO&lt;/STRONG&gt; to add new records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're doing a lot of INSERTS that can be quite slow. &amp;nbsp;I stumbled across INSERT ALL which can greatly speed up the process. &amp;nbsp;I chunked a large number of inserts into 200 inserts per chunk and saw great decreases in time. &amp;nbsp;Here's an example. &amp;nbsp;Note that you need "SELECT * FROM DUAL" at the end for some reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;INSERT ALL
  INTO mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
  INTO mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
  INTO mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
SELECT * FROM dual;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 19:37:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33785#M20025</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2016-12-16T19:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33788#M20026</link>
      <description>&lt;P&gt;Hmm, interesting. &amp;nbsp;I can actually create the tables by logging into oracle, but I'd love to get this working and the DBA hasn't been extremely helpful so far. &amp;nbsp;If I just try inserting the records how do I set it up to iterate through the JMP table records to insert them? &amp;nbsp;For example, let's say that I have a table in JMP with 100 records and 3 columns (ID, zip code, order amount). &amp;nbsp;How do I take what you just wrote and insert those records back into the table in oracle?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 20:02:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33788#M20026</guid>
      <dc:creator>beastwood</dc:creator>
      <dc:date>2016-12-16T20:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Questions using oracle SQL and JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33789#M20027</link>
      <description>&lt;P&gt;OK here's some code I cobbled together from a production system. &amp;nbsp;Names have been changed to protect the innocent and all that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Example", Add Rows( 3 ), 
		New Column( "ID", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [1, 2, 3] )	),
	New Column( "Zip Code", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [12345, 19117, 10111] )	),
	New Column( "Order Amount", Numeric, "Continuous", Format( "Currency", "USD", 17, 2 ),
		Set Values( [56.25, 34.11, 14.72] )	)
);


// Come up with a unique temporary table name
unique_table_name = "TMP_" || right(char(today()), 5) || "_" || 
			substitute(left(char(tick seconds()), 9), ".", "_");

dbc = create database connection(&amp;lt;insert your parameters here&amp;gt;);
max_inserts = 200;
nr = nrows(dt);

// Use a series of INSERT ALL INTO statements, which have good performance
sql_statement = evalinsert(
"CREATE TABLE ^unique_table_name^ (
	id           NUMBER,
	zipcode      NUMBER,
	ORDER_AMOUNT NUMBER)");

//show(sql_statement);
	execute sql(dbc, sql_statement);
		
sql_statement = "INSERT ALL ";

for (i = 1, i &amp;lt;= nr, i++,
	one_id = dt:id[i];
	one_zip = dt:zip code[i];
	one_amt = dt:Order Amount[i];

	sql_statement = sql_statement || evalinsert(
" INTO ^unique_table_name^ (ID, ZIPCODE, ORDER_AMOUNT)
  VALUES(^one_id^, ^one_zip^, ^one_amt^) ");

	if (mod(i, max_inserts) == 0,
// Weird - INSERT ALL INTO requires a SELECT statement at the end - use a dummy one
		sql_statement = sql_statement || " SELECT 1 FROM DUAL";
//		show(sql_statement);
		execute sql(dbc, sql_statement);
		sql_statement = "INSERT ALL ";
	);
);

// See if there's anything left to do
if (sql_statement != "INSERT ALL ",
	sql_statement = sql_statement || " SELECT 1 FROM DUAL";
//	show(sql_statement);
	execute sql(dbc, sql_statement);
);

close database connection(dbc);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 20:31:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Basic-Questions-using-oracle-SQL-and-JSL/m-p/33789#M20027</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2016-12-16T20:31:14Z</dc:date>
    </item>
  </channel>
</rss>

