1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to FTP or SFTP an ASCII file using PLSQL FTP API

Discussion in 'SQL PL/SQL' started by anirbanmukherjee86, Feb 5, 2014.

  1. anirbanmukherjee86

    anirbanmukherjee86 Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    Hi All,

    I am using Oracle Database 10g R2 version. I am trying to write an procedure which can FTP e file from local to remote server.
    I am using below piece of code:

    PROCEDURE generic_ftp_file(ftp_user VARCHAR2,ftp_password VARCHAR2)
    IS
    l_conn UTL_TCP.connection;
    BEGIN
    l_conn := ftp.login('ftp.company.com', '21', ftp_user, ftp_password);
    ftp.ascii(p_conn => l_conn);
    ftp.put(p_conn => l_conn,
    p_from_dir => 'DIR_OUTBOUND',
    p_from_file => 'testfile_controllog.csv',
    p_to_file => '/appmgmt/chintah/testfile_controllog.csv');
    ftp.logout(l_conn);
    END generic_ftp_file;


    But while compiling this, it is giving below error:

    LINE/COL
    --------------------------------------------------------------------------------
    ERROR
    --------------------------------------------------------------------------------
    67/2
    PL/SQL: Statement ignored

    67/12
    PLS-00201: identifier 'FTP.LOGIN' must be declared

    68/2
    PL/SQL: Statement ignored


    LINE/COL
    --------------------------------------------------------------------------------
    ERROR
    --------------------------------------------------------------------------------
    68/2
    PLS-00201: identifier 'FTP.ASCII' must be declared

    69/2
    PL/SQL: Statement ignored

    69/2
    PLS-00201: identifier 'FTP.PUT' must be declared


    LINE/COL
    --------------------------------------------------------------------------------
    ERROR
    --------------------------------------------------------------------------------
    73/2
    PL/SQL: Statement ignored

    73/2
    PLS-00201: identifier 'FTP.LOGOUT' must be declared


    It seems that FTP API is not a default one or may be I am using something wrong. Please guide me. and also let me if there is any other better option for this purpose.
     
  2. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation