cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting file FROM SFTP server using procedure in HANA Cloud

Afsal
Advisor
Advisor
0 Kudos

Hi,

I have one Windows server configured with SFTP.

I have already created a procedure to download files from this server to another using DPA (which was pretty straightforward with the help).

Now I need to delete some of the files from the server using the SFTP connection from the HANA cloud.

Any hints about a possible procedure to delete files from the SFTP server through a procedure or virtual procedure?

What I have already tried

-- delete_file_from_sftp.hdbprocedure

PROCEDURE "delete_file_from_sftp"()
LANGUAGE SQLSCRIPT
--DEFAULT SCHEMA "<MY_SCHEMA_NAME>" AS
BEGIN
EXEC 'sftp -o StrictHostKeyChecking=no <my_user>@<my_sftp_host> -P <my_password> "rm <MY_FILE>"';
END

The procedure was deployed successfully, but when I tried to execute, it returned:

Could not execute 'CALL "<MY_SCHEMA_NAME>"."delete_file_from_sftp"()'

Error: (dberror) [257]: sql syntax error: "<MY_SCHEMA_NAME>"."delete_file_from_sftp": line 10 col 4 (at pos 227): incorrect syntax near "sftp": line 1 col 1 (at pos 1)

Accepted Solutions (0)

Answers (0)