立即与支持人员聊天
与支持团队交流

Toad Data Point 6.2.3 - User Guide

Example Script: Populate Tables and Data

The following script demonstrates how to use Toad Script functions. This script creates the number of tables you specify. The script prompts you for the number of tables to create and the number of rows to create.

For more information about Toad Script functions and how to use them, see About Toad Script.

--: PROMPT tableCount = 'Enter the number of test tables to create'

--: SET i = 0

--: WHILE i < tableCount

--: SET i = i + 1  

CREATE TABLE testTable{{Unquote(:i)}} ( id INT PRIMARY KEY );

--: ENDWHILE

--: NOTIFY 'Done creating tables.'

--: ASK addData = 'Fill tables with test data?'

--: IF addData

--: PROMPT rowCount = 'Enter number of rows to create'  

--: SET i = 0  

--: WHILE i < tableCount  

--: SET i = i + 1    

--: SET j = 1    

--: WHILE j <= rowCount    

INSERT INTOtestTable{{Unquote(:i)}} VALUES (:j);

--: SET j = j + 1      

--: ENDWHILE    

--: PRINT 'Completed filling table ' || i    

--: ENDWHILE  

--:ENDIF

 

相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级