Home » SQL & PL/SQL » SQL & PL/SQL » Help.Alter Type
Help.Alter Type [message #31984] Tue, 27 July 2004 12:39 Go to next message
hwong
Messages: 1
Registered: July 2004
Junior Member
hi,

  I created a object type as follows:

CREATE OR REPLACE
TYPE O_TRANSACTION_DETAIL AS OBJECT
(
  AGREEMENTID NUMBER(12),
  ACCOUNTINGDT DATE,
  TRANSACTIONID NUMBER(12),
  FUNDID NUMBER(12),
  DETAILTYPECODE VARCHAR2(12),
  DETAMOUNT NUMBER(18,6),
  DETGAINLOSSAMT NUMBER(18,6)
)INSTANTIABLE NOT FINAL

Then, I performed a alter type to add a member function.

alter type o_transaction_detail
add not final MEMBER FUNCTION GetAmount(p_amt_type varchar2) return real

When check the source from user_source, the alter statement is part of the source! Why? 

 1  SELECT text
  2    FROM user_source
  3   WHERE name = 'O_TRANSACTION_DETAIL'
  4     AND type = 'TYPE'
  5*  ORDER BY line
SQL> /

TEXT
--------------------------------------------------------------------------------
TYPE O_TRANSACTION_DETAIL AS OBJECT
(
  AGREEMENTID NUMBER(12),
  ACCOUNTINGDT DATE,
  TRANSACTIONID NUMBER(12),
  FUNDID NUMBER(12),
  DETAILTYPECODE VARCHAR2(12),
  DETAMOUNT NUMBER(18,6),
  DETGAINLOSSAMT NUMBER(18,6)
)INSTANTIABLE NOT FINAL
 alter type o_transaction_detail

TEXT
--------------------------------------------------------------------------------
add not final MEMBER FUNCTION GetAmount(p_amt_type varchar2) return real cascade

I did a compile with alter type o_transaction_detail compile specification in Sql Plus. It compiled successfully, but the alter statement is the part of the source!  Having the alter statement there causes syntax errors in Toad's Procedure Editor.  I can't create and replace the type since it has dependecies.  Please help.

Thank, HWong
Re: Help.Alter Type [message #31993 is a reply to message #31984] Tue, 27 July 2004 23:48 Go to previous message
Barbara Boehmer
Messages: 9100
Registered: November 2002
Location: California, USA
Senior Member
It appears that the problem is with Toad's porocedure editor, since it is valid syntax, with the alter statement as part of the source:

scott@ORA92> create or replace TYPE O_TRANSACTION_DETAIL AS OBJECT
  2  (
  3    AGREEMENTID NUMBER(12),
  4    ACCOUNTINGDT DATE,
  5    TRANSACTIONID NUMBER(12),
  6    FUNDID NUMBER(12),
  7    DETAILTYPECODE VARCHAR2(12),
  8    DETAMOUNT NUMBER(18,6),
  9    DETGAINLOSSAMT NUMBER(18,6)
 10  )INSTANTIABLE NOT FINAL
 11   alter type o_transaction_detail
 12  add not final MEMBER FUNCTION GetAmount(p_amt_type varchar2) return real;
 13  /

Type created.
Previous Topic: Converting Procedures from Oracle to MSSQL Server using Tools
Next Topic: critical query -SQL
Goto Forum:
  


Current Time: Fri Nov 15 15:17:37 CST 2024