PROGRAMMER (USER) DEFINED RECORDS

Hi all;


I do self - study of PL/SQL concepts for user-defined folders.

I get the error.


SQL > desc emp;

Name                                      Null?    Type

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

EID                                               NUMBER

ENAME VARCHAR2 (15)

VARCHAR2 (10) EQUAL

ESALARY VARCHAR2 (15)

ECITY VARCHAR2 (15)


SQL > select count (*) from emp;

COUNT (*)

2


PROGRAMMER (USER) DEFINED RECORDS


SQL > DECLARE

2 C_cr CURSOR IS

3. Select ename, equality, esalary, eid, ecity emp;

4 EMP_DETAILS RECORD TYPE IS

5 (e_id emp.eid%TYPE,

6 e_name emp.ename%TYPE,

7 e_qual emp.equal%TYPE,

8 e_salary emp.esalary%TYPE,

e_city 9 emp.ecity%TYPE);

10 emp_detail e1;

BEGIN 11

12 C_cr OPEN;

LOOP 13

14 C_cr FETCH in emp_detail;

15 WHEN OUT C_cr % NOTFOUND;

16 DBMS_OUTPUT. Put_line (emp_detail.e_id | emp_detail.e_name | emp_detail.e_q ual | emp_detail.e_salary | emp_detail.ecity);

17 END OF LOOP;

18 DBMS_OUTPUT. Put_line (C_cr % ROWCAMOUNT);

19 CLOSE C_cr;

20 END;

21.

emp_detail e1;

*

ERROR on line 10:

ORA-06550: line 10, column 12:

PLS-00201: identifier "E1" must be declared.

ORA-06550: line 10, column 12:

PL/SQL: Ignored Element

ORA-06550: line 14, column 17:

PLS-00320: the declaration of the type of the expression is incomplete or

Malformed

ORA-06550: line 14, column 1:

PL/SQL: SQL statement ignored

ORA-06550: line 16, column 22:

PLS-00320: the declaration of the type of the expression is incomplete or

Malformed

ORA-06550: line 16, column 1:

PL/SQL: Statement ignored



SQL > select * from v version $;

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE 10.2.0.1.0 Production

AMT for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

Thank you all;

MY QUESTION IS: type_name, record_type must be the same?

It is not necessary to be the same. Once you create a record type, then it might be assigned to different variables, such as:

SQL > DECLARE

2 C_cr CURSOR IS

3. Select ename, equality, esalary, eid, ecity emp;

4 TYPE EMP_DETAILS IS RECORD

5 (e_id emp.eid%TYPE,

6 e_name emp.ename%TYPE,

7 e_qual emp.equal%TYPE,

8 e_salary emp.esalary%TYPE,

e_city 9 emp.ecity%TYPE);

10 emp_detail EMP_DETAILS;

11 emp_detail_2 EMP_DETAILS;

12 emp_detail_3 EMP_DETAILS;

13 l_id NUMBER;


Now, he becomes similar to a variable_type of variable_name in the declaration section. Emp_detail or emp_detail_2 is a variable of type EMP_DETAILS, like the variable l_id that can hold values of type numbers.

Tags: Database

Similar Questions

  • Initialize a constant which is a user-defined record type

    Hi all

    This may be a simple question, but I'm hard-pressed to find a solution.

    The PL/SQL documentation says I can declare a constant from a defined record type previously. But how to initialize in the declaration? For example.

    create or replace package my_package as
    type my_type is record (varchar2 (10) Field1, Field2 varchar2 (10));
    c_myconst constant my_type: = < what? >;
    end my_package;

    I tried the initialization function that does nothing more to return one my_type with the fields defined and which works except that PL/SQL has a restriction that this feature cannot be in the same package that the constant that will make my packages appear disorganized - I would be just as quickly initialize the constant online so down the line , programmers are not wondering why I call this function only in its own packaging.

    Is a syntax that will allow me to provide values for the c_myconst must in the declaration?

    Thank you
    John

    I checked - declare the INIT_ERR() function before using it to fill the constant makes no difference: it precipitates again PLS - 492.

    so the SQL Types seem the way to go...

    SQL> create or replace type err_type as object
      2      (err_num number(5,0),  err_msg varchar2(200));
      3  /
    
    Type created.
    
    SQL>
    SQL>
    SQL> create or replace package app_errs as
      2
      3      function init_err(p_err_num in pls_integer, p_err_msg in varchar2)
      4          return err_type;
      5
      6      c_bad_id constant err_type := err_type(-20000, 'Invalid ID');
      7
      8      procedure raise_err(p_err_num in pls_integer, p_err_msg in varchar2);
      9
     10  end app_errs;
     11  /
    
    Package created.
    
    SQL>
    

    Cheers, APC

    blog: http://radiofreetooting.blogspot.com

  • MS Intellimouse Explorer 2.0 has user programmable buttons, but this mouse is very hard to find. Is there an another wireless mouse which has programmable buttons user-defined?

    MS Intellimouse Explorer 2.0 has user programmable buttons, but this mouse is very hard to find. Is there an another wireless mouse which has programmable buttons user-defined?

    Thank you

    OOPS - I just read the description of the site and realize that this is the wrong forum for my questions.

    I'm sorry.

  • user-defined types

    Hi all

    I have a function that returns a type defined by the user in my sql environment. The type consists of 5 different columns. I pass a ref_id to my function, on the basis of which he does some calculations and returns me the type.

    create or replace type my_type

    (

    number of col1,

    col2 varchar2 (100),

    COL3 varchar2 (10),

    number of COL4,

    number of col5

    )

    create or replace function fun (number in_id) return my_type

    as

    Start

    -code1

    -code2

    Return (my_type)

    end;

    In my sql environment, I have a table which is the following structure

    create table tab1

    (

    number of emeline

    upgvc varchar2 (100),

    number of Ref_ID, - this ref_id when it is passed to the function above will return a populated user-defined type values.

    number of col1,

    col2 varchar2 (100),

    COL3 varchar2 (10),

    number of COL4,

    number of col5

    )

    I have a table tab2, using which i will be filling of the columns of the table tab1, tab2 table structure is as below

    create table tab2

    (

    number of emeline

    upgvc varchar2 (100),

    number of Ref_ID)

    now I have to fill each column in table tab1, tab2 table and my pleasure to feature.

    something like

    Insert into tab1

    Select emeline,

    upgvc,

    Ref_ID,

    Rest of the values must be completed by calling the function using the ref_id and fill in the values. What would be the best way to do it? I have millions of records with it. I tried to use this with the function of REGAL and tried fill lines, but its slow.  All of the suggestions.

    Note: apologies for not sticking scripts and the original code since it will take days

    Thank you

    Rahul

    PetervdZwan wrote:

    Hello

    I agree that you shouldn't calc function for each attribute. But you don't need an extra table for this type.

    See below:

    Not sure what you mean:

    SQL > set serveroutput on
    SQL > select a.deptno,.
    2 a.f.col1 col1,
    a.f.col2 3 col2,
    4 a.f.col3 col3,
    5 a.f.col4 col4,
    6 a.f.col5 col5
    7 of)
    8. Select wagneur, f1 (deptno) f
    scott.dept 9 d
    10          ) a
    11.

    DEPTNO COL1 COL2 COL3 COL4 COL5
    ---------- ---------- ---------- ---------- ---------- ----------
    10         10 A          B                   2          3
    20         20 A          B                   2          3
    30         30 A          B                   2          3
    40         40 A          B                   2          3

    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    SQL >

    As you can see, function runs again 5 times by each line. You need to materialize in line of sight. It can be done using NO_MERGE:

    SQL > select a.deptno,.
    2 a.f.col1 col1,
    a.f.col2 3 col2,
    4 a.f.col3 col3,
    5 a.f.col4 col4,
    6 a.f.col5 col5
    7 of)
    8 select / * + no_merge * /.
    wagneur, f1 (deptno) 9 f
    scott.dept 10 d
    11          ) a
    12.

    DEPTNO COL1 COL2 COL3 COL4 COL5
    ---------- ---------- ---------- ---------- ---------- ----------
    10         10 A          B                   2          3
    20         20 A          B                   2          3
    30         30 A          B                   2          3
    40         40 A          B                   2          3

    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    Call to F1
    SQL >

    However, I have and I know not why, the function is called not 4 but 6 times, using the type of collection (as in my first response) causes function calls only 4 - one per each line.

    SY.

  • How to get information about the types within a user defined package

    Hi all
    Have a package with some types (user-defined) defined in the package specification. How to get information about the types and
    information about the columns of this type.

    for example:
    Create package mp is

    type t is record (no number is varchar2 (30));

    procedure a (m t out...

    Thanks in advance.

    userg

    G_user wrote:
    the req's, want to build a script dynamically using data dictionary
    so if possible, I take the name of the type within the package specification.

    Let me rephrase - is there a data dictionary to get information on the type defined by the user within a package specification

    Best approach will be to have a standard in the definition of data types.

    Have a process to follow the object definitions in the package if it is mandatory.

  • When I print my paper to "user-defined" size in Thunderbird by default instead of "letter". Have to change manually, but does not.

    I use a printer Brother HL-6180DW and the paper size to default printer to 'letter' 8 1/2 x 11 on everything, except
    When you try to print an email from Thunderbird. If I manually change the paper size in Thunderbird to the letter, it maintains for that impression, then default to "user-defined" which is 3.0 x 5.0. How to make the default format letter? Thank you.

    I have answered hundreds of posts here every month. Most of the time I don't know who or what 5 seconds after I'm done.

    I did not add... I said to delete. You can remove all in printers and when you restart Thunderbird and try and print with the selected printer is the will add stuff if needed. So bite the bullet and simply delete away.

  • Question of the user defined Type (UDT)

    Hello

    The attached file is NEITHER sample to call a VB6 vi.

    The following is declared in the declaration section:

    ' Global declarations
    Dim lvapp As LabVIEW.Application
    Dim vi LabVIEW.VirtualInstrument

    When I paste these statement in another project (that I'm working on), I get an error 'undefined user-defined type '.

    Can someone point out to me were in the sample, these type definitions are declared?

    Thank you

    Rafi

    PS the attachment is indeed xxx.rar and not xxx.zip.  I changed the name because .rar has not been accepted.  Please rename .rar

    Thank you

    I forgot to mark references to my project

    Project--> references--> LabView. Type library of xxx

    Thank you

  • Use of user defined function in mathscript containing a structure

    Hi, I am a novice user of LabView MathScript module,

    I have the following problem when integrating my code MATLAB, LabView, for HMM: in my program, I tried to call a MATLAB called "mixgaussinit.m" user-defined function, it shows this error...

    "

    I just noticed that these files appear to be copyrighted. My first question is do you have author permissions to post them in a public forum? If this isn't the case, then you can remove them. That being said, I have reviewed the code and it seems easy enough to work around your problems (provided that you have the copyright permissions). How to bypass the problems is to replace the fields of the struct with variables. There is of course allows you to change some definitions of functions for input and output the necessary variables which I think was the best 5 variables. You will also need to redo the code that uses a table of error checking cell. In total, I estimated about 30 minutes of work. I would have given you work around these files had not been protected by copyright. So, unfortunately, you will need to implement the work around you.

  • variables of user-defined data transfer

    Hello

    I use the etherCAT 9144 chassis and is only supported by this hardware FIFO range target. After a search, I realized that the only way to transfer data from FPGA to the host by using user-defined variables. But these variables do not support the notion of FIFO. So which is the best practice to transfer data after measures (provable 10 Hz measurement of 15 values) to host VI?

    Thank you

    As mentioned, the 9144 only supports the analytical engine.

    In regards to what you do, it really depends on the entire application. For example, what is the master? Are there other systems at issue here? Etc. It's a good read, in general, although it might not help this second right: http://www.ni.com/white-paper/14151/en/

    A high level, you need to decide what you need. If you have need for deterministic communication, low-latency over long distances from a RT controller, the 9144 is probably the right choice. If you need low latency + streaming over short distances to a RT controller, you should look into the RIO MXI chassis. If you need mainly not deterministic low speed (10 hz) data mixed with low flow continuous over long distances to a windows or host RT, then ethernet expansion rio (9146,7,8,9) is probably the right choice. If you need high speed continuous with low control latency over long distances to a windows or RT host, you need a full cRIO controller. Based on what you've posted so far, its uncertain is the right person.

    Lets say you're stuck with the 9144 for now. As you can easily hit 1 kHz scanning cycles, it should be perfectly possible to data 'stream' to 10 Hz. If you run the scan at 1 kHz engine, then you are 100 x oversampling. Where it gets complicated is this requirement of sync. By default, acquisition input/output is synchronized to the clock of the scan (and you can see when the clock of scan is set by a knot of e/s FPGA). However, you can take complete control of a module in the FPGA and read inputs and outputs at any time if you please. In other words, you can set up so when DIO0 goes high you immediately enjoy all the values of AI 15. You can then transfer these values HAVE switched to the host using the user-defined variables.

  • 9144 with FPGA and SGL EtherCAT custom user-defined Variables?

    Hello

    I currently have a small instrument driver (rs485) running on a chassis of 9144. The output values are communicated to the master EtherCAT using FXP numbers. I would like to pass these FXP to SGL, since I've upgraded to SP1 2012 LV with FPGA now supports numbers of SGL.

    Is this possible? I tried several times to create the Variables defined by the user of SGL in the project, but the date type is gray.

    Greetings from Munich,

    Götz

    Unfortunately, SGL is not a data type supported for communication to and from a 9144. The types of data available for the I/O user-defined variables are:

    * Fixed point
    * Signed integers (Int8, Int16, Int32, Int64)
    * Integers (UInt8, UInt16, UInt32, UInt64)
    * 32 bit field
    * Boolean

    More information on I/O user-defined variables can be found at:

    Programming EtherCAT i/o with FPGA Intelligence to: Differences in LabVIEW FPGA programming API
    http://www.NI.com/white-paper/10618/en#toc4

  • User Defined King

    Hello Experts!

    I have a simple question.

    Is there a way, of creating user defined KING?

    For example, I want to create a return on investment, such as:

    Hello

    Yes and no. You can combine this KING of three kings of base: two lines and a circle (or ring). Movement will be a little tricky (because all three kings should be moved together with the movement of the mouse) - you need to do programmatically. ("Point of departure") example as an attachment. Think otherwise maybe twice - it will be easier to use single point KING with overlay instead of several Kings.

    Andrey.

  • I'm trying to migrate data from a server to a new one with the file permissions of the files of users and records lost.

    original title: robocopy

    I'm trying to migrate data from a server to a new one with the file permissions of the files of users and records lost. So far, that's what I did, I used \\server1\share \\server2\share/sec /mir robocopy and robocopy \\server1\share \\serve2\share/e/s /copyall. It seams like they copied all files with the permissions of the user for the files, but not files. For example, if a user makes a folder with the files in the folder appear them have permissions appropriate for them but not the root folder or subfolders, they did... How can I fix this and what is the difference between / s /mir and/e/s /copyall?

    Hello

    You can find the Server forums on TechNet support, please create a new post at the following link:

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • What are user defined variables (UDV)?

    I'm trying to debug an application in real time and have worked on known issues for LabVIEW Real-time 2011. There is a term called "user defined Variables (UDV)" that opens occationally document known issues with other documents. It seems that UDVs can be created under target FPGA but I am unable to find any useful information on them. I know only local, global, shared, single, variable IO process.

    Hi Lucie,.

    The /o Variables using the help documentation gives a pretty good explanation of what a user-defined variable is in the section "data i/o Variables for Custom FPGA of e/s". I hope that this documentation helps!

    Best,

    tannerite

  • How to set 'User defined' palette display IMAQ?

    When I select the "User defined" palette on the screen, it shows just the regular grayscale palette.  I want to replace that with the palette 'Rainbow' but slightly amended in the range.  How can I do this?

    Thank you!

    MK

    Wire a new array of RGBs 256 elements to the User Palette of your image window property.  You can use IMAQ GetPalette to retrieve the rainbow palette and change that.

  • How to create a user-defined Service

    Hello

    The Microsoft article "How to create a User-Defined Service" is very explicit. I understood how to deploy a file .exe as a windows service. But my executable creates and writes a .txt file that I do not see that appear when I starts the service. I have to do something special?

    Thanks in advance, supertreta.

    I found the answer: she was on C:\WINDOWS\system32. Sorry for my precipitate question.

Maybe you are looking for

  • iBook ios10 problems

    Changes to the ibook in ios10 are NOT an improvement: 1. the two page mode is now can be used with very small font 2 the Library button is missing 3. the function of the word define disappeared I liked my ibook so much, but now I really hate that! An

  • Icons control on page 29 of Firefox in the wrong place Windows 7 64 bit

    Page, minimize, maximize, close icons are upper-left. I don't want them there and they also annoy my file and edit menus, I want them to the location of traditional upper right, where they were with Firefox 28. No problem with my Windows XP 32 don't

  • Need to retrieve using an external dvd drive for Portege R series

    i've got criptolocker virus, I need to format the computer to load back up, my dvd player is broken, because the computer has drop down in the past. I put the recovery on an external dvd drive CD, but I'm not able to work, it detects the dvd drive in

  • How can I save my browser history, with dates and times included?

    I need save my history of the browser with the date and hours included. I tried to do the backup, but it saves to a JSON file and I do not know how to open that. Copy and paste into Notepad do not record the dates and times.

  • Re: My experience with Satellite A200

    Bought a Satellite A200 March or February, since the purchase, he really began to think that I made a BIG mistake. Cost me $2000 purchase and only after it home and unpacking, I found that my new laptop in TWO THOUSAND dollar do not even have an audi