How in Oracle can I export package that will have package and body? I'm using putty. How in Oracle can I export package and its body to a file in present directory using spool?

Thanks
Use SYS.DBMS_METADATA.GET_DDL to get a CLOB with the code:

declare 
  myPackageSpec clob;
  myPackageBody clob;
BEGIN
    select dbms_metadata.get_ddl('PACKAGE_BODY', 'PACKAGE_NAME', 'SCHEMA') 
       into myPackageBody
      FROM DUAL;
    select dbms_metadata.get_ddl('PACKAGE_SPEC', 'PACKAGE_NAME', 'SCHEMA') 
      into myPackageSpec 
    FROM DUAL;

  dbms_output.put_line(myPackageSpec);
  dbms_output.put_line(myPackageBody);
end;


You could also use expdp from command line and then impdpwith sqlfile

expdp scott/tiger@db10g schemas=SCOTT INCLUDE=PACKAGE SQLFILE=scott.sql directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
impdp scott/tiger@db10g SQLFILE=scott.sql directory=TEST_DIR dumpfile=SCOTT.dmp logfile=impdpSCOTT.log