This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes Varchar & Varchar2 in Stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Varchar & Varchar2 in Stored procedure" Watch "Varchar & Varchar2 in Stored procedure" New topic
Author

Varchar & Varchar2 in Stored procedure

Michelle Joe
Greenhorn

Joined: Oct 29, 2002
Posts: 11
I have created this stored procedure in Oracle:

CREATE OR REPLACE PROCEDURE get_product_code(prod_number IN VARCHAR) IS
CURSOR Get_code IS
<my_query_goes_here>
BEGIN
For Get_code_cur IN Get_code LOOP
DBMS_OUTPUT.PUT_LINE(Get_code_cur.name);
END LOOP;
END;


However, when i use SQL*Plus to view my stored procedure (command-->desc get_product_code'), i encountered the following:

Argument Name Type In/Out Default?
-------------------------- ------------------ ------ --------
PROD_NUMBER VARCHAR2 IN

I am curious why the type of the input parameter has been changed from VARCHAR to VARCHAR2?
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
may be it is deprecated. applying guess
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

As of Oracle 8, VARCHAR and VARCHAR2 are the same. However Oracle recommends using VARCHAR2 because VARCHAR may change in the future.

I'm not sure why it is changing it automatically for you though.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Varchar & Varchar2 in Stored procedure