---
title: "使用shell+procedure构造测试数据"
author: "8366"
date: "2012-01-17T15:27:41Z"
tags: []
categories: ["数据库"]
slug: "shell-procedure"
draft: false
lastmod: "2012-01-17T15:27:41Z"
id: 1354435
url: "https://8366.iteye.com/blog/1354435"
---

more test.sh  
#!/usr/bin/bash

export LD\_LIBRARY\_PATH=/usr/lib/oracle/10.2.0.3/client64/lib  
/usr/lib/oracle/10.2.0.3/client64/bin/sqlplus renxp/renxp@172.17.18.164:1521/orcl &lt;&lt;EOF  
delete from test\_xhu  
commit;  
create or replace procedure xhu\_proc is  
begin  
    for i in 1..5000 loop  
      insert into test\_xhu values(i,DBMS\_RANDOM.STRING('U',2048));  
    end loop;  
    commit;  
      insert into test\_xhu values('100001','sadasfffasd');  
      insert into test\_xhu values('100002','gfhghfhhf');  
      insert into test\_xhu values('100003','kljnsdfsdf');  
      insert into test\_xhu values('100004','yitoyitouds');  
      insert into test\_xhu values('100005','gagsgadiuyf');  
    commit;  
end xhu\_proc;  
/  
exec xhu\_proc  
exit;  
EOF