You can either grab the code from the stored procedures through SQL*Plus by querying views such as DBA_SOURCE, or you can also do this via a GUI tool such as Oracle's Enterprise Manager or Toad. Once you have the 'create or replace …' statements for the stored procedures you wish to migrate from the Oracle8i database, you would simply log into the Oracle9i database as the proper schema owner and run them via SQL*Plus. This would create the necessary stored procedures in the 9i database.
SQL queries are not stored within the Oracle database so they are not migrated, per se. SQL queries are either run via an application, or some other interface such as reporting tools, or the SQL*Plus command line by users and DBAs.
Dig Deeper on Oracle and SQL
Related Q&A from Maria Anderson
I have been trying to install Oracle 8.1.7 on SUSE Linux 9.0 and got the error: "Error in invoking target install of makefile /opt/oracle/...../*.mk." Continue Reading
I'm getting errors while installing the Database Configuration Assistant. Continue Reading
Can I use /var/opt/oracle/oratab to specify listener information? Continue Reading