Create a procedure SQL with SQL toolkit

Hello

I use the SQL Toolbox to get data from a MySQL database (using ODBC connectors).

I would like to automatically create a procedure on my DB when lauching my application software, so that I do not know there is when I use it.

But I can't figure out how to do with the SQL Toolbox.

Indeed, you try to run this script (which works by operating on MySQL workbench) returns the following error:

DELIMITER $$

CREATE DEFINER='indus'@'%' PROCEDURE ' FPY'(datetime IN START_DATETIME, IN END_DATETIME datetime)
BEGIN
CREATE a temporary table ListingUUT
(
UUT_SERIAL_NUMBER VARCHAR (127).
TEST_COUNTER INT,
DateTime TEST_TIME,
UUT_STATUS VARCHAR (32)
);

CREATE a temporary table Stat_FPY
(
TESTED INT,
TESTED_ONCE INT,
REPORT / FLOAT
);

INSERT INTO Stat_FPY VALUES (0,0,0).
INSERT INTO ListingUUT
(
SELECT
UUT_SERIAL_NUMBER, SUM (1), START_DATE_TIME, UUT_STATUS
OF booster_results.uut_result
WHERE START_DATE_TIME BETWEEN START_DATETIME AND END_DATETIME
UUT_SERIAL_NUMBER GROUP
ORDER BY DESC START_DATE_TIME
)
;

END

-Online error-2147217900 took place at NI_Database_API.lvlib:Conn Execute.vi-> Untitled 1

Possible reasons:
ADO error: 0x80040E14
Exception occurred in the Microsoft OLE DB provider for ODBC drivers: [MySQL] [ODBC 5.2.a Driver] [mysqld - 5.6.10 - log] you have an error in your syntax SQL; consult the manual for your version of the MySQL server for the right syntax to use near ' DELIMITER $$

CREATE DEFINER='indus'@'%' PROCEDURE ' FPY '(IN START_DATETIME datet' à la ligne 1 en NI_Database_API.lvlib:Conn Execute.vi-> sans titre 1)

An idea so that I can create the procedure?

Finally, give up on the creation of the procedure with SQL Toolkit functions.

In fact using exec.vi system to address directly the command-line mysql server...

Tags: NI Software

Similar Questions

  • Database MySQL with SQL Toolkit

    Hello

    We use CVI 2012 and the SQL Toolkit 2.2 and we want to connect to a MySQL database.

    The MySQL database has been created with MySQLServer. When we try to connect with the BD connection, we get an error.

    How can connect us to the MySQL database?

    What do we have to type in the connection string to the DB? What is the name of the database, the path to the database or anything else?

    Have experience with the SQL toolkit?

    Thanks in advance

    Oliver

    You must install the mysql odbc connector and then create an ODBC dns for your database.

    Control Panel, administration, odbc

  • With CVI SQL Toolkit, how to add the new variable param column in a table.

    Dear all:

    I used the CVI Sql toolkit to create a database, but now I don't know how to add a new column to a table in variable param.

    I know, to add a column with the name of constant column could be down by below:

    DBImmediateSQL ((hdbc, "alter table table1 add column1 char [100]");

    But if Column1 is a param variablae how can I write the code? Please advise?  It will be appreciated if you could give me an example.

    Best regards!

    HI -.

    If you look at the parameters that you pass to the SQL function, you can see that the second parameter is a string constant. In your code, you can create an array of characters (string). You can then use sprintf to programmatically determine what will be the contents of this variable. In the function call, you can put the variable instead of the literal string, and you will have a customizable SQL statement.

    Hope this helps-

    John M

  • create a new user with password expire - problem SQL Developer

    Hi people,

    I use RDBMS 11.2.x on Solaris and Linux, and in the face of a problem that I hope someone can help me with.

    Our policy is to create a new account with a temporary password and force them to reset the password at the first login.

    Therefore, I use: "create user < username > identified by < user > password expire...» »

    The problem is that many users use Oracle SQL Developer and do not have access to SQL * more.

    When I user logs in the database for the first time in SQL Developer, he just tells them that the account is locked.

    It does not say the password is expired, and it does not give them a way to change this (that I can find it).

    I'm not familiar with SQL Developer and hoped for someone who has had a similar problem can offer some suggestions.

    Thank you.

    Jim

    Change password dialog is no longer Pop Up after ORA-28001 (password expired) (Doc ID 811736.1)

  • Creating views, dynamic SQL within stored procedure

    I'm having a problem with the creation of dynamic views of in a stored procedure. The following declare block works fine:

    DECLARE
    parameter i_nom_table varchar2 (200): = 'abc ';
    xyz cursor script, SELECT step
    STARTING from scripts
    WHERE table_name = i_nom_table parameter
    ORDER BY step CAD;
    l_sql scripts.script%TYPE;
    l_step scripts.step%TYPE;
    l_error VARCHAR2 (200);
    l_code VARCHAR2 (200);
    Start
    XYZ OPEN;
    LOOP
    XYZ-FETCH INTO l_step, l_sql;
    OUTPUT WHEN xyz % NOTFOUND;
    immediately run l_sql;
    insert into ingest_log values (null, sysdate, i_nom_table, l_step, l_sql, 'Success' parameter);
    END LOOP;
    CLOSE XYZ;
    insert into ingest_log values (null, sysdate, parameter i_nom_table, 0, "Accomplished all the steps.", "Success");
    EXCEPTION WHEN OTHERS THEN
    l_error: = substr (SQLERRM, 1, 200);
    l_code: = SQLCODE;
    insert into ingest_log values (null, sysdate, parameter i_nom_table, l_step, l_sql, l_code |) ' - ERROR - ' | l_error);
    END;

    However, if I create a procedure with this block and try to run it I get an insufficient privileges error. Do not know why. All tables, views, procedures are under the same user, and the user that I'm connected as the runtime of the declare block. The user has the following privileges:

    Connect, resource, xdbadmin, s/n

    Any reason you can think of for this? Script values are generally "CREATE OR REPLACE VIEW As.... » ;

    Permissions in Oracle to do indirectly through roles are not available when compiling packages, functions, and stored procedures. Direct subsidies are required during the creation of these objects in the database.

    http://articles.TechRepublic.com.com/5100-10878_11-6183799.html

  • Problem connecting SQL toolkit Win7

    I use CVI 2013 and tto toolkit (2.2) of SQL to connect to a mySQL database.  I can connect to properly using my development computer, but not with the target.  Both computers are running 64-bit Windows 7 Professional (SP1).  I used to start the 64-bit ODBC drivers (mysql-connector-odbc - 5.3.2 - win64.msi) on both machines.  After I got hurt, I found an article in the Knowledge Base which indicated that I should probably use the 32-bit instead.  So I deleted the drivers of the target and installed those 32-bit using odbcad32.exe found in Windows/SysWOW64.  No change.

    I use the sample browser2.prj project included with the SQL Toolkit (default: C:\Users\Public\Documents\National Instruments\CVI\samples\sql\apps) to test the functionality of the SQL tool.  I create a distribution kit, including the runtime shared on the development computer and install it on the target.  I traced the problem to the call of DBSources() - it returns a - 100 (who, the hand is not among the list of database error codes).

    On both machines the ODBC drivers seem to work.  I can get to the database using Panel-> administration-> Data Sources (ODBC) tools.  Select the user DSN or system DSN database, and then click Configure open the MySQL Connector/ODBC Data Source Connection window.  By clicking Test in this window will connect to the database.

    If the problem seems to lie in the way that ICB connects to the database.  I'm naïve now, any suggestions would be greatly appreciated.

    Sorry if this is a stupid question:

    Have you followed the instructions help-> Reference Library-> library Toolkit SQL-> SQL language reference-> distributing a SQL Toolkit executable or a DLL?

    Or is it a mistake you get despite following these instructions?

  • SQL toolkit connection problems on ICB

    Hi all.

    I wrote this post because I'm not able to find a solution for the problem of the Telegraph...

    I have developed a program that uses SQL Toolkit, the CVI 9. I have access to a MS Access 97 database, using an ODBC (DSN = MyProgram) connection.

    The program works well, on windows 7 and windows XP (windows xp is the operating system of the end user).

    However, when I install the program on the pc to the end user (windows xp) and then create the DSN user on ODBC connections, I got an error during execution of the program. We mean the error is not possible to connect to the database (its the ODBC connection).

    As I said, on the other machine, different, with windows xp, it works!

    I'm a little lost. Do I need a special component installed to SQL Toolkit fine work?

    The PC with XP where the application works, has the same applications installed as the end user's PC.

    I tried to install on the end user the LabWindows CVI SQL Toolkit with pc, and I checked that when connecting to the DSN will be tried, I get "unknown error."

    Help will be very appreciate!

    Run it on pc without Sql toolkit, you must copy the cvidb32.dll into your your windows system32 folder.

  • problem of memory sql toolkit

    Hello

    We use CVI 2012 and SQL Toolkit 2.2. Once a minute, we're looking a record for a special SQL database and we update the data in this leaflet. After update, let's close the database. Whenever we do this procedure that we see in the Task Manager which increases the memory needs of our program.

    After a few minutes (20-30) we get an error message memory.

    Anyone know if there is a problem to know or can someone help us?

    Thanks in advance

    Oliver

    Here is a part of the code:

    //
    hdbc = DBConnect (DATABASE_STRING);

    //
    HSQL = DBActivateSQL (hdbc, "' SELECT * FROM 'data_l01'" ");

    //
    RW = DBBindColChar (hsql, SQL_DATE, 32, cDB_Date, & iDB_Date_State, "");
    RW = DBBindColChar (hsql, SQL_TIME, 32, cDB_Time, & iDB_Time_State, "");
    RW = DBBindColInt (hsql, SQL_SPEED, & iDB_Clock, & iDB_Clock_State);

    Flag, ob der entry found wurde loeschen
    iFoundFlag = 0;

    Find the folder that we want to update
    While ((rw = DBFetchNext (hsql)) == DB_SUCCESS)
    {
    //
    If ((StrICmpWithoutSurrWhiteSpace (cDB_Date, cDate) == 0) &)
    (StrICmpWithoutSurrWhiteSpace (cDB_Time, cTime) == 0))
    {
    Flag, ob der entry found wurde set
    iFoundFlag = 1;
    break;
    }
    } / / Ende von find the folder that we want to update

    Daten uebernehmen
    iDB_Clock = Mutec;

    Insert the record into the database
    RW = DBPutRecord (hsql);

    //
    RW = DBDeactivateSQL (hsql);

    //
    RW = DBDisconnect (hdbc);

    Hi Oliver,.

    To read your code, I understand that you open a connection to the database for each update that you want to run.

    Usually I would advice you to open the database connection to the start once this reference until the program is closed instead of open every time.

    This could potentially solve your problem.

    Please let me know if that solves your problem.

    Best regards

    Raphael

  • Am about to buy DW.  2 quick questions before proceeding.  (1) can I associate a DW created an EXTERNAL SQL Express database for the read/write site?  Can be made safe?  (2) am plans to use Contribute to allow non-technical users to end dry change

    Am about to buy DW.  2 quick questions before proceeding.  (1) can I associate a DW created an EXTERNAL SQL Express database for the read/write site?  Can be made safe?  (2) am plans to use Contribute to allow non-technical end users EASILY change the sections of the web site.  Can this work?  Thank you.

    I would like some ideas.

    A CMS is the standard solution in the industry today. The most common environment is LAMP (LINUX, Apache, MySQL, PHP).

    Some of us to write custom CMS systems for a living. I concentrate on CMS for retirement centers. There are all kinds of solutions CMS available ranging from generalist, off-the-shelf CMS like WordPress, completely custom, with a lot of opportunities in the meantime.

  • Create the PL/SQL package in SQL Developer 4.0.0.12

    Hello

    I built a model in SQL Developer 4.0.0.12 and I want to create a PL/SQL package.

    In ODMiner 11.1.0.4 of 'Tools' > 'Create pl/sql package' I can get a script to create the package and every thing is OK.

    but in SQL Developer, I select "Deploy" from the popup menu of each node and it generates a folder containing scripts associated with each node. I don't see any relevant script for creating a package.

    How can I create a PL/SQL package in my workflow?

    Thanks for any help you can provide in this situation.

    Please see this whitepaper to find out how to build the PL/SQL package for deployment of workflow:

    Oracle Data Miner (Extension of SQL Developer 4.0)

    PL/SQL script for the deployment of workflow

    http://www.Oracle.com/technetwork/database/options/advanced-analytics/odmrcodegenwhitepaper-2042206.PDF

  • Display button CREATE only if SQL Report (form report) contains no data.

    Hello

    I have a created a form with report (page 1 & 2). By default, APEX creates all the buttons.
    I want to display the button CREATE in the SQL report (page1) only if there is no data, if the report shows a line, I'm not display button to CREATE.

    Is there any way I can store (returns the value of the report) *... no data found... * as flag '0' to a certain place and then use the CONDITIONAL DISPLAY for the button CREATE based on this indicator.

    Thank you
    Deepak

    Hi Dan,.

    I think that these substitution strings are there to custom paging purposes - but this particular one (#TOTAL_ROWS #) is useful for this sort of thing.

    Dembélé - Sorry, just reread your post and saw that you only want to display the button when there is no line!

    Button attributes to the button, put:

    ID="P137_TEST_BUTTON" style="visibility:hidden"
    

    and in area foot region, put:

    <script type="text/javascript">
    if (#TOTAL_ROWS# == 0)
    {
     $x('P137_TEST_BUTTON').style.visibility = "visible";
    }
    </script>
    

    OTN workspaces are down now (again!), so I can't update my example page - but, I hope, you should get the idea of this

    Andy

  • -What is the function of SQL or API Availble in SQL Toolkit 2.2 connection (Urgent)?

    Hello

    I have to build an application using LabWindows 2010 and SQL Toolkit 2.2. Is there any function or dll or api availble so that I do not want to link in the ODBC Control Panel.?

    Concerning

    Umer


  • CVI sql toolkit

    Hello

    We use the CVI 2012 and the last sql toolkit. We want to find and update the data in a mysql database. But we have the problem that we still get an error message.

    Here's our code:

    // -----------------------------------------------------------------------

    initialisiert das SQL Toolkit
    DBInit (DB_INIT_MULTITHREADED);
    DBInit (DB_INIT_SINGLETHREADED);

    //
    sprintf (String, "DSN = SYSTEM_DATABASE; Server = 127.0.0.1; Basis of data = backup_demo8; UID = root; PWD = admin");

    //
    hdbc = DBConnect (String);

    //
    HMAP = DBBeginMap (hdbc);

    //
    RW = DBMapColumnToInt (hmap, 'speed', iSpeed, & iSpeedState);
    RW = DBMapColumnToChar (hmap, "datetime", 32, cDateTime, & cDateTimeStat, "");

    Activate the map
    HSTMT = DBActivateMap (hmap "plots");

    Find the folder that we want to update
    While ((rw = DBFetchNext (hstmt)) == DB_SUCCESS)
    {
    //
    If (StrICmpWithoutSurrWhiteSpace (cDateTime, ' 05:37 "" ") == 0)
    break;
    }

    //
    iSpeed = 10;

    Insert the record into the database
    RW = DBPutRecord (hstmt);

    //
    RW = DBDeactivateMap (hmap);

    //
    RW = DBDisconnect (hdbc);

    // -----------------------------------------------------------------------

    When we call the cmd DBPutRecord we get the attached error message

    Can someone help us?

    Thanks in advance

    Best regards

    Oliver

    Hello

    I found a solution in the meantime:

    The Board features seem to be the problem. A google search I found a few comments about similar problems.

    Using the SQL functions activate 'normal', it runs.

    Here is my solution:

    // -----------------------------------------------------------------------

    initialisiert das SQL Toolkit
    DBInit (DB_INIT_MULTITHREADED);
    DBInit (DB_INIT_SINGLETHREADED);

    //
    sprintf (String, "DSN = SYSTEM_DATABASE; Server = 127.0.0.1; Basis of data = database_l01; UID = root; PWD = admin");

    //
    hdbc = DBConnect (String);

    //
    HSQL = DBActivateSQL (hdbc, "' SELECT * FROM 'data_l01'" ");

    //
    RW = DBBindColChar (hsql, SQL_TIME, 32, cTime, & cTimeStat, "");
    RW = DBBindColInt (hsql, SQL_SPEED, iSpeed, & iSpeedState);

    Find the folder that we want to update
    While ((rw = DBFetchNext (hsql)) == DB_SUCCESS)
    {
    //
    If (StrICmpWithoutSurrWhiteSpace (cTime, ' 05:34 "" ") == 0)
    break;
    }

    //
    iSpeed = 15;

    Insert the record into the database
    RW = DBPutRecord (hsql);

    //
    RW = DBDeactivateSQL (hsql);

    //
    RW = DBDisconnect (hdbc);

    // -----------------------------------------------------------------------

    Thank you and Bravo to me :-D

    Oliver

  • mySQL and SQL Toolkit 2.0

    Hello

    I use a database mySQL and sql toolkit 2.0 in application of Labwindows CVI.

    I have a problem when the database increases in size. Indeed, when the number of records reached 3 million, the program memory is 1.7 GB. So, it stops on an Out of Memory error.

    The program memory increases when I use the DBActivateMap function, before adding the records.

    For now, I use the following method to add records:

    DBBeginMap

    DBMapColumnToDouble

    DBMapColumnToDouble

    ...

    DBActivateMap

    DBCreateRecord

    DBPutRecord

    Will there be another opportunity to open the table and add records?

    Thank you for your help.

    Benjamin

    Hello

    Have you tried to use sql statement directly to y to insert a data, for this, you can use this function:

    DBActivateSQL

    And for the sql statement you can use:

    Table INSERT [] [(GBA)]
    {VALUES (list_of_value) | requete_select |} DEFAULT VALUES}

    Kind regards

  • ORA-00942 - create a procedure

    When I create this procedure

    It's a return ORA-00942 on line 6, but I have the privilege to choose on dba_tables.


    CREATE OR REPLACE PROCEDURE p_read_only
    AS
    BEGIN
    FOR x IN (SELECT table_name
    FROM dba_tables
    Owner WHERE = 'MAN')
    LOOP
    RUN IMMEDIATELY ' GRANT SELECT ON SWH.»
    || x.table_name
    || "TO READ_ONLY.
    END LOOP;

    FOR x IN (SELECT view_name
    FROM dba_views
    Owner WHERE = 'MAN')
    LOOP
    RUN IMMEDIATELY ' GRANT SELECT ON SWH. "| x.view_name
    || "TO READ_ONLY.
    END LOOP;
    END;
    /

    Thank you

    Published by: Jx on July 19. 2011 08:10

    In the future please check for errors before you post thereon. This error is with ORA-1031, PLS-201 and ORA-12514 error more popular on this forum, always because people post here never use online resources.

    No, you do not have privilege. You have the privilege, thanks to a role and roles are disabled during the compilation of the procedures as roles can change on the fly.

    You must
    or the other

    (1) create or replace... AUTHID current_user
    (2) grant select privileges directly on dba_tables.

    The last method is not preferable, because you will end up with a myriad of direct privileges which are not included in your export, they are owned by SYS and SYS is not exported.

    Also in DDL in a procedure is generally considered bad because it has all kinds of side effects.
    A regular SQL script should be sufficient.

    ----------------
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • MacBook pro continues to tell me login password is wrong when I know it's good. After typing the password even about 9 times, it connects

    Hello! When I turn on my macbook pro and enter my password, it always says that my password is wrong. I know that my password is right for you. I type the right password even 5 to 9 times until it works. After that I are connected and stay away from

  • Left button of the mouse on the A30

    Someone at - he heard of a problem with the mouse button on a Satellite A30, the left button of the mouse is solid, it just support at all so I have to use an external mouse, careful to try this price Im look without damanging it again, anyone know t

  • Swedish system 6.0.8 version?

    Hello I restore my Mac Plus 1 MB, but since my keyboard are Swedish, I can't take full advantage of my international keyboard with a version of American English (or any other language besides version). Where can I download system 6.0.8 in Swedish? Be

  • TouchSmart 520 keyboard does not

    Yesterday, I was using my computer when the keyboard suddenly stopped working.  I jumped the old batteries, which lasted for a while (Duracell curiously) and put in 2 AAA Energizer batteries.  I go back and the keyboard will not connect.  I know the

  • How macht ACS

    Hi, I am in a project with the Cisco environment, but without any contract with the own partner or Cisco. so... I am in need of some information: 1 - anyone knows how mach ACS application? Version 5.1 or others. 2 - my customer wants to make a contra