Problems with the declarations of Type in Oracle 9i

Create OR replace Type Ty is object
(
attr1 varchar2 (30),
attr2 Varchar2 (30),
attr3 Varchar2 (30),
Manufacturer Ty function return AS a result,
Ty (p_attr1 IN Varchar2) constructor function
Return self as RESULT,
Constructor Function ty (p_attr1 IN Varchar2,
p_attr2 IN Varchar2)
Return to SELF, RESULT,
Constructor Function Ty (P_attr1 IN Varchar2,
P_attr2 IN Varchar2,
P_attr3 IN Varchar2)
Return self as RESULT
);
/
Create OR replace Type body Ty like
Ty function constructor return self as result that
Start
RETURN;
End;
Constructor function Ty(p_attr1 IN Varchar2) return
SELF as RESULT that
Begin
COTTAGES. Attr1: = p_attr1;
RETURN;
End;
Constructor Function Ty (p_attr1 IN Varchar2,
P_attr2 IN Varchar2)
Return self as RESULT that
Begin
COTTAGES. Attr1: = p_attr1;
COTTAGES. Attr2: = P_attr2;
RETURN;
End;
Constructor Function Ty (P_attr1 IN Varchar2,
P_attr2 IN Varchar2,
P_attr3 IN Varchar2)
Return self as RESULT that
Start
COTTAGES. Attr1: = P_attr1;
COTTAGES. Attr2: = P_attr2;
COTTAGES. Attr3: = P_attr3;
RETURN;
End;
End;
/
Declare
T1 Ty: = Ty();
Ty T2: = Ty ('A');
T3 Ty: = Ty('B','C');
T4 Ty: = Ty('D','E','F');
Begin
dbms_output.put_line (t1. Attr1);
dbms_output.put_line (t2.attr1);
dbms_output.put_line (t3. Attr1);
dbms_output.put_line (t4. Attr1);
End;
T4 Ty: = Ty('D','E','F');
*
ERROR on line 5:
ORA-06550: line 5, column 12:
PLS-00307: too many statements of "TY" corresponds to this call
ORA-06550: line 5, column 6:
PL/SQL: Ignored Element
ORA-06550: line 10, column 25:
PLS-00320: the declaration of the type of the expression is incomplete or
Malformed
ORA-06550: line 10, column 3:
PL/SQL: Statement ignored

Please help me what is the problem with me? I use Oracle 9i release 2.

You don't need to declare a constructor for "all" attributes - you get one automatically. Remove the declaration of the complete constructor function on all 3 attributes, and you will find your block works fine dbms_outputs.

Tags: Database

Similar Questions

  • Problem with the CLOB data type.

    Greetings,

    I am facing a problem with the CLOB data type. I know that the CLOB data type is 4 GB (I use Oracle 9i). But in the Pl Sql procedure, I can only store 34305 size for a CLOB variable character data.

    This is the test script that I am trying to run.

    DECLARE
    -Local variables here*.
    I have INTEGER;
    C_1 CLOB.
    BEGIN
    FOR Rec IN (SELECT
    *
    ACCORDING TO THE TABLE)
    LOOP
    C_1: = c_1 | Rec.Clo_1;
    END LOOP;
    EXCEPTION
    WHILE OTHERS THEN
    Dbms_Output.put_line (SQLERRM);
    END;


    Here variable C_1 range value 34305 good character regardless of type CLOB. Now the above script fails if query my buckle - huge number of return values. It is throwing the exception "error during transfer of files ORA-06502: PL/SQL: digital error or value."

    He would be grateful if someone can help me on this.

    Thank you.

    You are probably better off using DBMS_LOB.append, instead of the concatenation of varchar2 (|).

    And... take off your when-other Manager exceptions, please...

  • problem with the blob data type

    Hello
    Hi just created a blob table data type and insert a text file of the directory - file "DG" and text contain text "Hello dba.

    CREATE TABLE blob_sample (id, NUMBER, blob_data BLOB);

    DECLARE
    l_bfile BFILE.
    l_blob BLOB;
    BEGIN
    INSERT INTO blob_sample (id, blob_data)
    VALUES (1, empty_blob())
    RETURN blob_data INTO l_blob;
    l_bfile: = BFILENAME ("'DG', ' hello.txt");
    DBMS_LOB. FileOpen (l_bfile, Dbms_Lob.File_Readonly);
    DBMS_LOB. LoadFromFile (l_blob, l_bfile, DBMS_LOB.getlength (l_bfile));
    DBMS_LOB. FileClose (l_bfile);
    COMMIT;
    END;
    /

    SQL > select * from blob_sample;
    ID BLOB_DATA
    1 68656C6C6F206462612773

    Above is coded image shape & I try this with the Insert as below... IT WORKS
    SQL > insert into blob_sample (id, blob_data) values (1, '68656C6C6F206462612773');

    1 line of creation.


    But this does not work when encoded length is too large (size 10 KB text file or more)

    It returns error

    insert into blob_sample (blob_data) values ('416374697
    *
    ERROR on line 1:
    ORA-01704: string literal too long


    Please HELP how how can I insert with this method

    Published by: Mr. singh on 9 October 2012 18:54

    Published by: Mr. singh on October 9, 2012 19:38

    It does not make sense to try to build a literal string that represents the binary data in a GIF file and that insert a BLOB using an INSERT... Statement of VALUES.

    You can use the first approach (dbms_lob.loadfromfile) to load a GIF file (or any file) into a BLOB.
    If the image you are trying to load is not a file on the filesystem of database, you can use SQL * Loader on the client machine to load the data, or you can write an application in any language you want that reads the data from the file and inserts it into the BLOB by using the API in your language / framework. You have not told us what language and framework you use, but it shouldn't be too hard to find a suitable example. For example, if you use Java and JDBC, here is an example of loading a GIF in a table.

    Justin

  • Problems with the Long data type conversion

    With the help of Oracle 11 G.

    I have a vision where one of the name of the column is of type long, I need to convert in varchar2. I tried using the to_Lob() function, but this error:

    ORA-00932: inconsistent data types: expected - got LONG

    I followed this article (step 1), which suggests to use to_lob()

    My query is:
    select
    item1, -- this is of type LONG
    item_vat, 
    price_pc_tot,
    from xd_item_price_view 
    I tried to convert it into:
    select
    to_lob(item1) as item1_x, -- this is of type LONG
    item_vat, 
    price_pc_tot,
    from xd_item_price_view 
    I am confused about the "-", why he would expect that? Thanks for watching it.

    >
    Sorry mate, just realized that. Yep, this is the one I followed (step 1 using to_lob())
    >
    It's a case of 'use' along in a query or search.

    But you can use to_lob as part of creating a new table.

    Response to see Dom Brooks in this thread
    Re: Conversion long to varchar2

    And he directly answered your original question
    >
    But you can't use TO_LOB in a statement SELECT right:

  • problem with the tab control type def

    Hello community,

    There is still much more to learn more about LabVIEW.

    I have a tab control which is a (non-strict) type definition. It has 5 tabs with indicators.

    When I open type def and insert another tab, say three position and close type def, the tab on my fp control will of course win the additional tab.

    But the new number three tab will contain this as the former number tab three content and only the last tab will be empty.

    This isn't what I wanted. I think that I am doing it wrong.

    Is it possible to get an empty tab posted on three without defeat the purpose of a def type (because obviously I could decouple the def of type control, insert the tab and do a new type def).

    Best regards

    Florian

    Florian,

    I hope that you will display the tab as a user interface control in one place. In this case, you can have a typedef enum to subVIs and disconnect the the typedef tab control.

    Thank you

    George S

  • unexpected problem with the permission of type plsql function scheme

    Hello
    I created a schema authorization function plsql type returning a Boolean. Authorization scheme is for pages only. p2_user_priviledge is a textbox control on the home page that retrieves privilege (list of the pagenos) to the user of the database connection. Homepage has no required permissions. SCHEMA AUTHORIZATION always returns false. I am not able to trace problem in my code. same code works fine for failure to the 'c' of return area.

    -CODE OF AUTHORIZATION SCHEME-
    declare
    PageID varchar2 (10);
    VARCHAR2 (300) of privilege;
    c number (3);
    Start
    PageID: = ": P" | to_char(:app_page_id) |': '; -NUMPAGE stored in format *: P2: *
    privilege: = trim(:p2_user_priviledge); ++-List contain privileges like: P2:P13:P67:P23: etc +++ select instr (privilege, pageid) in c to double;
    If c > 0 then
    Returns true;
    on the other
    Returns false;
    end if;
    end;

    ------------------------------------------------------------------------------------------------------------------------------------------

    Another problem is again related to the authorization scheme.
    I created an application and schema of an authorization (auth_aug), which worked fine. Then, after a few days, I added more than 10 pages for the same application, but now autho_aug always returned false for new pages. Then I copied the code from the "autho_aug" to the new "autho_sept" regime, and it worked for new pages. I do not understand if code is the same for both system, why had to use two different schemas.
    Now, I've added a few pages more enforcement and problem mentioned earlier.

    any solution to the two problems...

    Hello

    You can create a component of demand through the shared components in your application, elements of Application option. All you do here is to create a new item and give it a name.

    Once this is done, the element can be used as if it were a page element. You can use an Application (also available through shared components) calculation to set the value of this element in the list of page numbers and the value can then be retrieved in a SQL statement or PL/SQL.

    You cannot use the popup window Session to change elements from page or application - you will need to create a calculation or process to do.

    Andy

  • Problem with the ASD file type

    I discovered an important document was recovered by WORD, but when I tried to open, he was informed that it is an ASD file.

    Windows directed me to a site that contains a list of FREE downloads of software designed for ASD Files "difficulty and open."

    It comes, I know not that you trust that I have already installed DriverCure, my security watchdog immediately sandboxes there as soon as I start!

    Could someone suggest the best, in all respects, free downloads to open the ASD files?

    Very grateful,

    JififnerM

    See the following article to see if it helps.  Word should automatically rename and open the ASD files loading:http://support.microsoft.com/kb/107686.  Maybe if configure you an automatic recovery file and place the file in there, that's going to happen the next time you open Word.

    If this does not help, please repost your question in the Forums Office: http://social.answers.microsoft.com/Forums/en-US/wordcreate/threads , where experts in Word will be happy to help you.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • A problem with the standard edition of synonyms oracle 12 c on linux.

    Hi all

    I created a few synonyms for a user to access the tables little.

    but unfortunately he is not able to view the user tables.

    Here's the syntax I used to create synonyms AS SYSTEM USER on oracle 12 c.

    create synonym WALLACE. DEPT_LOSS_RUN for the USER. DEPT_LOSS_RUN;

    He has successfully created, but WALLACE users NOT able to access / view on it.

    All the expert advice on that.

    Thanks in advance

    See you soon

    > do I have to give select grant Wallace for all 700 tables?

    Everything is forbidden; except what is explicitly GRANTED.

    COIL NEW_GRANTS. SQL

    SELECT "CHOOSE GRANT MARKET | TABLE_NAME | "AT WALLACE;" FROM USER_TABLES;

    SPOOL OFF

    @NEW_GRANTS. SQL

  • Problem with the percentage data type

    Hello

    I understand that if a member account data type is percentage, then the corresponding value in the form of data is displayed as a percentage. For example, if I need to get 50% against the particular account member, then I can type either 0.5 or 50%. But is there the parameters by which if I hit 50, system will consider as 50%, not 5 000%.

    Thank you.

    You can type either 0.5 or 50%

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Problem with the incompatible data type

    Hi all

    I wrote this query and trying to run it and got the following error.

    I got this error when I add column.if description I do not add the description column query works fine. _

    Attempted to solve by other means but did not work.

    Please help on this.

    SELECT the description, product, /*Defect.Product*/
    TO_CHAR (BG_DETECTION_DATE, 'yyyy') year,
    TO_CHAR (BG_DETECTION_DATE, 'Q'). ' Q'Quarter
    BUG
    where service_type as "Incident".
    and produced in ("Siebel", "Intg_Mgmt", "SOA", "NICE", "Genesys", "DW Analytics")
    AND DETECTION_DATE
    BETWEEN TO_DATE('01-01-2009','MM-DD-YYYY')
    AND TO_DATE (OCTOBER 30, 2010 ","DD-MM-YYYY")

    Group of to_char(bg_detection_date,'yyyy'), to_char(bg_detection_date,'Q'),
    product, description

    order by product, year desc, asc quarter


    error: ORA-00932: given inconsistent type.expected get clob_

    Try to replace every occurrence of "description" by 'dbms_lob.substr (description, 100, 1)' in your query, for example.

    It of OK if you want to show how only and group using the first 100 characters of the column "description".

  • problem with the definition of a boolean as output parameter type

    Hi, I have a problem with the definition of type boolean as output parameter and it must return true if the query procedure retrieves one line else it shouuld return false

    Hi, I have a problem with the definition of type boolean as output parameter and it must return true if the query procedure retrieves one line else it shouuld return false

    And what are the issues? Its simple.

    SQL> create or replace procedure is_emp_exist
      2  (
      3     p_empno  in  emp.empno%type
      4   , p_result out boolean
      5  )
      6  as
      7     l_empno emp.empno%type;
      8  begin
      9     select empno into l_empno
     10       from emp
     11      where empno = p_empno;
     12
     13     p_result := true;
     14  exception
     15     when no_data_found then
     16        p_result := false;
     17  end;
     18  /
    
    Procedure created.
    
    SQL> declare
      2     l_result boolean;
      3  begin
      4     is_emp_exist (7788, l_result);
      5
      6     if l_result then
      7        dbms_output.put_line('Employee Exist');
      8     else
      9        dbms_output.put_line('Employee does not Exist');
     10     end if;
     11  end;
     12  /
    Employee Exist
    
    PL/SQL procedure successfully completed.
    
    SQL> declare
      2     l_result boolean;
      3  begin
      4     is_emp_exist (1000, l_result);
      5
      6     if l_result then
      7        dbms_output.put_line('Employee Exist');
      8     else
      9        dbms_output.put_line('Employee does not Exist');
     10     end if;
     11  end;
     12  /
    Employee does not Exist
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • strange problem with the database link

    Hello world

    I have a strange problem with the link of database in Oracle 11 g Express Edition;
    There are two computers: computer-server and the client computer. Tnsnames.ora are the same on both computers IE.

    CT =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = krzysztof) (PORT = 1521))
    )
    (CONNECT_DATA = (SERVICE_NAME = XE)
    )
    )

    I created the database link:

    Create database link zdalny
    Connect to < user_id > identified by < password >
    using "CT".

    Customer cannot connect with server when I do not use above the command. But when I change 'use' for using "krzysztof:1521" or by using "krzysztof" or "server IP:1521" - everything is ok.

    Why I ask. Because in all the materials that I read about Oracle command with the help of "CT" should work correct. But there is no. Do you know why?

    Thanks in advance and apologize me for my English.

    Rgds
    Krzysztof

    Here's the tnsnames of your server, but to connect to the oracle server db (any client or to another instance of db oracle), you must install oracle client.
    However, in your condition, you want to connect the DB1 Oracle OracleDB2 using a link db, I'm right? In this case you should always set the entry in the tnsnames.ora
    To verify that you can connect to Oracle DB2 from DB1 Oracle, you can use tnsping in the command line.
    In your case

    c:\tnsping CT
    

    Krzysztof Szymaniak wrote: CT =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = krzysztof) (PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = XE)
    )
    )

    Check your tnsnames entry in the machine, you are trying to connect to. And check if the tnsping is successful.
    Sometimes the error message says not everything, which means that you need to troubleshoot yourself and learn from the experience.
    Always in the opposite case, refer to the documentation.

    See you soon.

    Published by: Spongebob December 14, 2011 09:30

  • problem with the CLOB type

    Hello, I am a beginner, I have a problem with the CLOB type, please help me
    I want to write the input file is filename and string base64, then output decoded base64 content in dicrectory location (for example C:\),my code was executed but if entry with base64 long string, it displays error)
    ORA-29285: file write error
    ORA-06512: at "SYS.UTL_FILE", line 136
    ORA-06512: at "SYS.UTL_FILE", line 813
    ORA-06512: at "SYSTEM.WRITED", line 9
    ORA-06512: at line 1
    29285. 00000 -  "file write error"
    *Cause:    Failed to write to, flush, or close a file.
    *Action:   Verify that the file exists, that it is accessible, and that
               it is open in write or append mode.
    And this is my code
    create or replace directory dir_temp as 'C:\';
    /
    create or replace procedure writed(filename varchar2,code  clob)
    as
      f utl_file.file_type;
      v_lob          BLOB;  
    
    begin
      v_lob :=  UTL_ENCODE.BASE64_DECODE( UTL_RAW.CAST_TO_RAW(to_char(code)) ); 
      f := utl_file.fopen('DIR_TEMP', filename, 'w');
      utl_file.put_line(f,to_clob(utl_raw.cast_to_varchar2(v_lob)));  
      utl_file.fclose(f); 
    end;
    Thank you
    DBMS_XSLPROCESSOR.clob2file(
      cl => l_clob
    , flocation => 'XML_LOG'
    , fname => myfile_name
    );
    

    for example

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    type t_emps is table of emp%ROWTYPE;
      3    v_emps    t_emps;
      4    --
      5    v_clob    clob;
      6    v_newline varchar2(2) := chr(13)||chr(10);
      7  begin
      8    -- get the rows into a PL/SQL collection of records
      9    select *
     10    bulk collect into v_emps
     11    from emp;
     12    -- build up the CLOB
     13    v_clob := 'EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO';
     14    for i in 1..v_emps.count
     15    loop
     16      v_clob := v_clob||v_newline||
     17                to_char(v_emps(i).empno,'fm9999')||','||
     18                v_emps(i).ename||','||
     19                v_emps(i).job||','||
     20                to_char(v_emps(i).mgr,'fm9999')||','||
     21                to_char(v_emps(i).hiredate,'YYYYMMDD')||','||
     22                to_char(v_emps(i).sal,'fm99999')||','||
     23                to_char(v_emps(i).comm,'fm99999')||','||
     24                to_char(v_emps(i).deptno,'fm99');
     25    end loop;
     26    -- write the CLOB to a file
     27    DBMS_XSLPROCESSOR.clob2file(cl => v_clob, flocation => 'TEST_DIR', fname => 'myfile.csv');
     28* end;
    SQL> / 
    
    PL/SQL procedure successfully completed.
    
  • Problems with the date in the procedure on Oracle 11 g

    Hi gurus,

    I have some problems with the date under Oracle 11 g format.

    Let me explain the situation:

    When I start such a request
    Select to_number (to_char (to_date('01.04.2009','dd.mm.yyyy'), 'yyyy'))
    of sys.dual

    I had as a result 2009 under the number.

    When I do the same thing in a procedure of a package like this

    my_year: = to_number (to_char (to_date('01.04.2009','dd.mm.yyyy'), 'yyyy'));

    the my_year variable contains the value 9 instead of 2009.

    Can someone explain to me what goes wrong?

    I just tested with the evolution of the variable nls_date_format of environment for the session and the database is complete without success.

    Kind regards
    Björn

    Yes, it has everything to do with your environment settings.

    SQL> set serveroutput on;
    SQL>
    SQL> declare
      2    my_date date;
      3    my_zeitstempel varchar2(32767);
      4    my_tageswechsel float;
      5  begin
      6    my_zeitstempel := '01.03.1998 07:00';
      7    my_tageswechsel := .25;
      8    my_date := to_date (substr (my_zeitstempel, 1, 10), 'dd.mm.yyyy') + my_tageswechsel +1/24;
      9    dbms_output.put_line( my_date);
     10  end;
     11  /
    01-MAR-98
    
    PL/SQL procedure successfully completed.
    
    SQL> alter session set nls_date_format = 'dd.mm.yyyy hh24:mi:ss'
      2  /
    
    Session altered.
    
    SQL> declare
      2    my_date date;
      3    my_zeitstempel varchar2(32767);
      4    my_tageswechsel float;
      5  begin
      6    my_zeitstempel := '01.03.1998 07:00';
      7    my_tageswechsel := .25;
      8    my_date := to_date (substr (my_zeitstempel, 1, 10), 'dd.mm.yyyy') + my_tageswechsel +1/24;
      9    dbms_output.put_line( my_date);
     10  end;
     11  /
    01.03.1998 07:00:00
    
    PL/SQL procedure successfully completed.
    
  • Problem with the DATA types, in a UNION

    Hello
    I m trying to disply a custom message when no data found using the structure below. Unfortunately I ve you have a problem with the data types I im trying to union
    I tried different types of data in the 2nd SELECTION tool but the rest of the problem. Help, please.

    SELECT HOSP_NAME 'HOSPITAL' DOC_SUR 'NAME', 'NAME' DOC_NAME, d.DOC_ID ID, diagnosis
    H., DOCTOR d, (SELECT d.DOC_ID, COUNT (d.DIAGN_ID) diagnosis
    OF PATIENT_DIAGNOSIS d
    GROUP BY d.DOC_ID)
    WHERE diagnosis > 1

    UNION ALL

    SELECT TO_CHAR ('test'), TO_CHAR ('test'), TO_CHAR ('test'), TO_CHAR ('test'), 0
    OF THE DOUBLE
    If NOT EXISTS (HOSP_NAME 'HOSPITAL' 'NAME' 'NAME' DOC_NAME DOC_SUR, d.DOC_ID ID, diagnosis
    OF ΝΟΣΟΚΟΜΕΙΟ h, ΙΑΤΡΟΣ d, (SELECT d.DOC_ID, COUNT (d.DIAGN_ID) diagnosis
    OF PATIENT_DIAGNOSIS d
    GROUP BY d.DOC_ID)
    WHERE diagnosis > 1);


    ORA-01790: expression must have same type of data, matching expression
    01790 00000 - "expression must have the same type of data, matching expression.

    DOC_SUR 'NAME' DOC_NAME 'NAME', ID d.DOC_ID, HOSP_NAME "HOSPITAL", diagnosis

    What is the data type for these columns

    To_char('test'), to_char ('test'), to_char ('test'), to_char ('test'), 0

    What you're doing here 'test' is already a character. Why do you use TO_CHAR?

Maybe you are looking for

  • DAQmx Setup error

    I have a brand new with Windows7 - 64 bit.  I installed LV 2010 RT, FPGA and all drivers. No problem.  I then installed LV 2012 with RT, FPGA, a few tools and drivers.  I got an error when installing on DAQmx.  I told him to continue.  Then, I got an

  • problems with my computer

    I have a hp pavilion a819n and about 2 years ago my pc crashed and I had windows xp. my friend told me that his friend could fix. While he does and put windows xp professional on my pc. so now, many programs do not work. He also told me I couldn't do

  • I don't see the red color on the computer screen.

    Red color went from my screen and seems to be replaced by black. GPU is a GeForce 7050/nForce 610dans. Could there be a compatibility problem with a recent automatic update? Change of monitor-problem still exists. Check the cable problem still exists

  • OfficeJet Pro 6230: Print head: missing, defective or Incompatible

    I have a 3 month old printer Officejet 6230 Pro who now will not be printed.  I get this message: "print head: missing, defective or Incompatible. I tried: (1) the printer reset (2) I have genuine HP cartridges (3) removed, cleaned and replaced cartr

  • Photosmart 100 driver for windows 7

    I need the printer driver for HP Photosmart 100 for windows 7, does anyone know if there is an and if yes where can I I get it.  I tried already to the HP Web site.