Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for read_dir function #24

Closed
ZakiGomaa opened this issue Jan 26, 2024 · 2 comments
Closed

Support for read_dir function #24

ZakiGomaa opened this issue Jan 26, 2024 · 2 comments

Comments

@ZakiGomaa
Copy link

ZakiGomaa commented Jan 26, 2024

Hello,

I would like support on how to use the read_dir function in the as_sftp package.
I am facing difficulties defining the correct return type in pl/sql anonymous block. Any advice?
Sample code:
declare l_hostname varchar2(100); l_username varchar2(100); l_password varchar2(100); l_rem_dir varchar2(100); type tp_dir_line_test is record ( file_name varchar2(32767) , long_name varchar2(32767) , is_directory boolean , file_size number , uid number , gid number , perm number , atime date , mtime date ); type tp_dir_listing_test is table of tp_dir_line_test; l_dir_listing_test tp_dir_listing_test; begin l_hostname := get_sftp_host; l_username := get_sftp_usr; l_password := get_sftp_pwd; l_rem_dir := get_sftp_dir; xx_as_sftp_pkg.open_connection(i_host => l_hostname); xx_as_sftp_pkg.login(i_user => l_username, i_password => l_password); xx_as_sftp_pkg.set_log_level(1); l_dir_listing_test := xx_as_sftp_pkg.read_dir(i_path => l_rem_dir); end;

Executing the above block results in ORA-06550: line 26, column 23: PLS-00382: expression is of wrong type

@antonscheffer
Copy link
Owner

A direct quote from the usage.md

declare
  l_dir_listing as_sftp.tp_dir_listing;
begin
  as_sftp.open_connection( i_host => 'localhost' );
  as_sftp.login( i_user => 'demo', i_password => 'demo' );
  as_sftp.set_log_level( 0 );
  dbms_output.put_line( as_sftp.pwd );
  l_dir_listing := as_sftp.read_dir( i_path => '.' );
  for i in 1 .. l_dir_listing.count
  loop
    dbms_output.put_line( l_dir_listing( i ).file_name );
  end loop;
end;

@ZakiGomaa
Copy link
Author

Thanks a lot for the prompt help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants