Example of
Calling the Loader with Perl ScriptCreate a database session
Log on to the database instance
Create a table and query the error code
Use a
# Reference to the SAP DB Perl Library
# -------------------------------
use SAP::DBTECH::loader;
# Parse the call arguments
# --------------------------
$userid = $ARGV[0];
$password = $ARGV[1];
$database_name = $ARGV[2];
$data_path = $ARGV[3];
$server_node = "localhost";
# Create a database session for the Loader
# -------------------------------------------
$session = loader::Loader ($server_node, $database_name);
# Log on to the database instance
# --------------------------------
$session->cmd("use user $userid $password;");
$rc = $session->sql('EXISTS TABLE CUSTOMER')
If $rc!=0
# Create the table CUSTOMER
# -------------------------
$session->cmd ( 'CREATE TABLE customer ( '.
print $rc
If $rc==0
#
Load the table CUSTOMER$loadrc = $session->cmd ("DATALOAD TABLE
customer ".print $loadrc
# End the database session
# ----------------------------
undef $session