Create Insert Statements from Oracle Table

THIS PROGRAM WILL TAKE ALL THE RECORDS
FROM AN ORACLE TABLE AND CONSTRUCT
INSERT STATEMENTS.
USE: IF THE TABLE IS LOST, YOU CAN RECONSTRUCT
HOW? JUST COPY THE OUTPUT THIS PROGRAM AND PASTE IT IN SQLPLUS PROMT






<%

result=request("result")
   sql1=request("sql1")
   if sql1 <> "" then
   sqlarray=split(sql1,"$")
   table_name=sqlarray(0)
   if ubound(sqlarray)=1 then
      extention=sqlarray(1)
   end if
   end if
   password=request("password")
   password_data="PUT YOUR PASSWORD HERE"
   if password=password_data then
     permit="yes"
     end if
  %>


insert statement




 
 
  <%
 
  response.write(table_name)
 
 
  %>

<%
if result="DONE" then
%>





SUCCESSFULLY COMPLETED



<%
end if
%>
<%
if result="CHECKPASSWORD" then
%>





CHECK THE PASSWORD




<%
end if
%>




<% if table_name <> "" and permit="yes" then
   if extention="" then
   sql="select * from " & table_name
   else
   sql="select * from " & table_name & " " & extention
   end if
  ' response.write(sql)
     
              set rs1=myconn.execute(sql)
              if rs1.eof then
                 response.redirect("sql.asp?result=Sorry.No records found")
              end if



             
              myarray=rs1.getrows()
         
   end if
%>


<% if table_name <> "" and permit="yes" then%>

<%
field_list=""
for i=0 to (rs1.fields.count - 1)

field_list=field_list & rs1.fields(i).name

If i < rs1.fields.count -1 then
field_list=field_list & ","
End if

next
%>

<%for i =0 to  ubound(myarray,2)%>







<%
 Response.write("insert into "  & table_name & "("&field_list&") values (")
j=0
for j =0 to (rs1.fields.count - 1)
dt=""
field_type=cint(rs1.fields(j).type)
' Response.write(rs1.fields(j).type & "******")
if isNULL(myarray(j,i)) then
  Response.write("NULL")

    Elseif field_type=200 Then


  Response.write("'")
Response.write(myarray(j,i))
Response.write("'")

Elseif field_type=135  Then
  dt=myarray(j,i)
  if isdate(dt) then
  dd=day(myarray(j,i))
  mm=monthname(month(myarray(j,i)))
    yy=year(myarray(j,i))
  dtf=dd & "-" & mm & "-" & yy
  Response.write("'" & dtf & "'")

   else
  Response.write("'")
Response.write(myarray(j,i))
Response.write("'")

end if
Elseif field_type=5  or field_type=131then

  'Response.write("'")
Response.write(myarray(j,i))
'Response.write("'")

End If
If j < rs1.fields.count -1 then
Response.write(",")
End if

Next
 Response.write(");" )
 ' Response.write(")" & """" & ")")

%>


<%next %>

<% end if %>



<%
if Request("is_report") ="" then
%>













Password :



Enter the Select Statement

Separate tablename and the condition by $ sign



















<%end if%>