Allowed setting SQL Execution Method to enable execution of the stored procedure creation statement as a single statement. Allowed adding remarks to the SQL statements without affecting execution.
Allowed calling stored procedures when the data source was a HP Vertica and GaussDB 200 database.
To process data in a database, such as creating, updating, deleting, reading, and summarizing data, you can use the SQL Script node.
You can use SQL statements to process data.
After selecting the data source type and a data connection, you can write SQL statements to process data. Note that:
The SQL statements must be written in accordance with the syntax of the connected database.
You can reference custom parameters or assignment parameters from upstream nodes in SQL statements to perform data insertion, update, and deletion in the database. The following image is an example. For details about the parameter-referencing method in SQL Script, see Parameter Overview.
You can call stored procedures when reading data from MySQL, Oracle, SQL Server, HP Vertica, GaussDB 200, IBM Db2, and SAP HANA databases. For details, see Calling Database Stored Procedures in Scheduled Tasks.
Starting from FineDataLink V4.1.11.2, SQL Script supports the execution of single and multiple SQL statements. You can input a stored procedure creation statement, and set SQL Execution Method to Execute A Single Statement, as shown in the following figure.
The SQL script is sent to the database for execution without being split.
1. Only statements for creating stored procedures are supported here; statements with command separators, such as delimiter, are not supported.
2. Stored procedures of Oracle databases are not supported.
Execute Multiple Statements (Separated by Semicolon (;))
CREATE PROCEDURE fdldemotest.Deletemoney1(IN nu INT)BEGIN DELETE FROM fdldemotest.Order_Customer_Information WHERE `Freight` = nu; select * from fdldemotest.Order_Customer_Information;END
Click Run to execute the task. You can see the created stored procedure, as shown in the following figure.
This example demonstrates how to create two tables, insert data into one table, and store the summary data from that table in the other table using the SQL Script node in Data Development.
1. Create a scheduled task, set the location and name, and enter Development Mode, as shown in the following figure.
2. Drag in an SQL Script node and configure it as shown in the following figure. The SQL statement creates two tables, order1 and order2, with the same fields ID and inventory, as shown in the following figure.
The SQL statement is as follows.
USE `fdldemotest`;CREATE TABLE IF NOT EXISTS `Order1` ( `ID` INT, `inventory` INT) ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE IF NOT EXISTS `Order2` ( `ID` INT, `inventory` INT) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3. Click Node Information to enter the tab page and rename the node Database Table Creation, as shown in the following figure.
1. Drag in another SQL Script node and configure it as shown in the following figure. The SQL statement inserts 9 records into the order1 table, as shown in the following figure.
insert into `fdldemotest`.`Order1` (ID, inventory)values (1, 20);insert into `fdldemotest`.`Order1`(ID, inventory)values (1, 21);insert into `fdldemotest`.`Order1` (ID, inventory)values (1, 22);insert into `fdldemotest`.`Order1` (ID, inventory)values (2, 23);insert into `fdldemotest`.`Order1` (ID, inventory)values (2, 24);insert into `fdldemotest`.`Order1` (ID, inventory)values (2, 25);insert into `fdldemotest`.`Order1` (ID, inventory)values (3, 26);insert into `fdldemotest`.`Order1` (ID, inventory)values (3, 27);insert into `fdldemotest`.`Order1` (ID, inventory)values (3, 28);
2. Click Node Information to enter the tab page and rename the node Inserting Data into Order1, as shown in the following figure.
1. Drag in another SQL Script node and configure it as shown in the following figure. The SQL statement groups and summarizes data from Order1 and inserts the result data into Order2, as shown in the following figure.
insert into `fdldemotest`.`Order2`select ID, sum(inventory) from `fdldemotest`.`Order1` group by ID
2. Click Node Information to enter the tab page and rename the node Inserting Grouped Data into Order2, as shown in the following figure.
Click Run to execute the task. After a successful execution, the log is displayed as shown in the following figure.
After successful execution, you can see two new tables in the database:
Order1:
Order2:
After successful execution, click Publish to publish the task to Production Mode, as shown in the following figure.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy