<?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: Help with using a SQL stored procedure to pull data using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/704848#M88914</link>
    <description>&lt;P&gt;I'm not sure what database you're using.&amp;nbsp; I use Oracle which has different syntax, but there are some general principles that may be helpful:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Execute SQL cannot return table data from a call to stored procedure directly.&lt;/LI&gt;
&lt;LI&gt;If your stored procedure creates a table, make a second call to retrieve that data.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This works in Oracle:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;execproc = "begin myuser.my_oracle_proc; end";
query    = "SELECT * FROM myuser.mytable";
 
// Run the procedure to load the table tblCost_Outliers
Execute SQL( dbc, execproc ); 

// Retrieve the table into the variable dt
dt = Execute SQL( dbc, query ); 
 
//tidyup
Close Database Connection( dbc );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Maybe JMP tech support can help you with the correct syntax for calling a procedure for your database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Dec 2023 14:41:42 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2023-12-01T14:41:42Z</dc:date>
    <item>
      <title>Help with using a SQL stored procedure to pull data using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/704612#M88880</link>
      <description>&lt;P&gt;Good evening,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm a beginner to JSL.&amp;nbsp; I think suspect that I have a syntax error or something.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to run an SQL stored procedure from a JSL script.&amp;nbsp; My database connections seem to work correctly (see when the query is a select statement).&amp;nbsp; However, I can't get the stored procedure to run and give me the data table.&amp;nbsp; Below I've listed:&lt;/P&gt;
&lt;P&gt;1) the query formula that works (the select statement) and&lt;/P&gt;
&lt;P&gt;2) the three query formulas that won't run my stored procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for taking a look.&amp;nbsp; --Birdi (JMP 17.0.0)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// HELP:  The select statement works but the stored procedure doesn't.  
//Does anyone have an idea as to what I'm missing?
 
// I can run the select statement, but I could use some help on running the stored procedure.
//query="SELECT * FROM [dbo].[tblCost_Outliers]"; // works
query = "exec dbo.procCost_PM_Birdi"; // doesn't work
//query="begin dbo.procCost_PM_Birdi; end;"; // doesn't work
//query = "dbo.procCost_PM_Birdi"; // doesn't work
 
 
//create connection
dbc = Create Database Connection(
	"DSN=*****;UID=*****;PWD=*****;APP=JMP;WSID=*****;DATABASE=*****;"
);
 
//get result
Execute SQL( dbc, query ); 
 
//tidyup
Close Database Connection( dbc );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What does that mean to use &amp;lt;JSL&amp;gt; to insert JSL code?&amp;nbsp; Yep, I'm new.&amp;nbsp; Thank you for your patience.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 22:01:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/704612#M88880</guid>
      <dc:creator>PleaseRecycle</dc:creator>
      <dc:date>2024-08-05T22:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with using a SQL stored procedure to pull data using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/704848#M88914</link>
      <description>&lt;P&gt;I'm not sure what database you're using.&amp;nbsp; I use Oracle which has different syntax, but there are some general principles that may be helpful:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Execute SQL cannot return table data from a call to stored procedure directly.&lt;/LI&gt;
&lt;LI&gt;If your stored procedure creates a table, make a second call to retrieve that data.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This works in Oracle:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;execproc = "begin myuser.my_oracle_proc; end";
query    = "SELECT * FROM myuser.mytable";
 
// Run the procedure to load the table tblCost_Outliers
Execute SQL( dbc, execproc ); 

// Retrieve the table into the variable dt
dt = Execute SQL( dbc, query ); 
 
//tidyup
Close Database Connection( dbc );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Maybe JMP tech support can help you with the correct syntax for calling a procedure for your database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 14:41:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/704848#M88914</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2023-12-01T14:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help with using a SQL stored procedure to pull data using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/706859#M89130</link>
      <description>&lt;P&gt;See&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Discussions/SQL-query-to-ODBC-datasource-SQL-server-with-temporary-tables/m-p/457582#M70262" target="_blank"&gt;https://community.jmp.com/t5/Discussions/SQL-query-to-ODBC-datasource-SQL-server-with-temporary-tables/m-p/457582#M70262&lt;/A&gt;. This will help you with this issue since you are using SQL Server.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 15:40:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-with-using-a-SQL-stored-procedure-to-pull-data-using-JSL/m-p/706859#M89130</guid>
      <dc:creator>Dahlia_Watkins</dc:creator>
      <dc:date>2023-12-07T15:40:37Z</dc:date>
    </item>
  </channel>
</rss>

