Help the insertion of an unknown number of lines in a custom Data Type

Hi all

I need help in the insertion of an unknown number of lines in a custom Data Type

In Oracle I was thinking something like...
CREATE OR REPLACE TYPE &HKDB_Schema_Name..SOMEDATA AS OBJECT (ID int, Name varchar2);
/
CREATE OR REPLACE TYPE &HKDB_Schema_Name..TYP_TABLE AS TABLE OF &HKDB_Schema_Name..SOMEDATA;
/

CREATE OR REPLACE PROCEDURE &HKDB_Schema_Name..SProc1
(
)
AS
l_TempTable TYP_TABLE := TYP_TABLE();
v_count NUMBER := 0;
l_ID int;
l_Name varchar2(200);
BEGIN
 
  LOOP
  -- exit the loop if the select returns no results. (look if exists in l_TempTable)
  v_count := SELECT COUNT(*) FROM Person p WHERE p.ID NOT IN (SELECT ID FROM TABLE(CAST(l_kgListTable AS TEMP_KGID_TABLE)));

  -- select the top result
  SELECT p.ID, p.UserName INTO l_ID, l_Name FROM Person p WHERE p.ID NOT IN (SELECT ID FROM TABLE(CAST(l_kgListTable AS TEMP_KGID_TABLE)))  
  AND ROW_NUM = 1;

  insert data into custom data type
  l_TempTable.extend;
  l_TempTable(l_TempTable.last) := SOMEDATA(l_ID, l_Name);

  EXIT WHEN v_count < 1;
  END LOOP;
END SProc1;
While I don't know this will probably do the job, it feels not very effective, have to select where the argument no_lig = 1 and then insert a facility on time. Is there a better way to do it?

Basically, it's a migration of a MSSQL stored procedure where the equivalent would be...
DECLARE @TempTable TABLE (ID int, Name varchar)

INSERT INTO @TempTable (ID, Name) (SELECT ID, UserName FROM Persons)
Thanks in advance,
Toby

Oh sorry you posted that before but I missed it. In this case maybe you should simply remove the

as "HasChildren"{pre} part. This is only valid for a column name, but you input that expression directly into a type. It is not a column at this point.

Tags: Database

Similar Questions

  • Causing problems of custom data type to deploy the shared target RT variable

    I seem to have some difficulty in using a shared variable published network created from a customized data type when it is deployed as an executable on a target of cRIO RT.  I'll start by describing why I think that this is the rub.  I created my RT VI in the LabVIEW (LV 2012) development environment and everything works fine.  This VI is quite simple, because these were quickly devolved into an exercise in debugging.  The RT VI begins by simply flashing the LED to a couple of times and then starts a loop simple acquisition to read some values out of the material using the analytical engine (while still flashing the LED of the user).  After reading the material, the values are grouped in a cluster and written in a shared variable published to the network defined by a custom control type def.  The custom control contains five floats double precision.  If it's important, the RT cRIO system hosts the shared variable in this case.

    So I have that deploy in the development environment, and everything works fine.  The LED flashes merrily along, telling me that the program runs correctly.  Running a VI host who reads the shared network has published variable gives the desired result.  Everything is good.

    Now, I want the cRIO system to run this simple program by itself at startup.  I build, set it as start VI, deploy it, and then restart the cRIO target.  The LED never flashing... the VI doesn't seem to work.  I'll spare you the major part of the work of debugging and access to the end.  I basically "diagram Disabled" various sections of the code up to the VI began to run correctly in an executable file.  I kept reducing the size of the disabled code until something has been disabled: the writing in the shared variable for the custom data type.

    So, I guess my question is this: are custom data types defined by type def would be personalized orders authorized executables to RT?  I read through the cRIO Developers Guide, my book of development in real time course of NOR and the white paper using shared Variables and I see nothing that forbids it.  I know that there are things not allowed in the executable files that are allowed in the development environment (property nodes façade, dialogue live, operating system specific calls, etc.), but no mention of the shared variable type custom data.  Any ideas as to why my VI is running in the development environment, but does not update unless I have delete the entry on the published network variable shared?

    Thank you in advance for your help!

    You must disconnect the data types of variables and then recompile. You can find it useful to keep on disk, a copy of the original lvlib.

    Don't know if this is a bug or not. It was suggested by someone in the forum that putting the ctl files in the right position (the disk? in the draft?) would allow the rtexe start; I did a quick check and it didn't work then I dropped the tests more far.

  • Desperately need help - "the partition table on device sda was unreadable." Erase all data?

    I'm forced to install CentOs on my Macbook using a machine virtual (VMWare, which is what I downloaded my teacher recommended). It's for my first class of operating systems, so bare with me because I don't know anything about operating systems (except about how to use Windows and my Macbook). I am also a daughter, what makes my same technical knowledge that much more rare. However, I am eager to learn...

    In any case, I downloaded them both. When I launch Fusion, I choose the file> New> install Windows or another OS on a virtual machine> continue without disk> click on the button that says 'Operating system installation disc using image file'> then I select the appropriate iso CentOS (CentOS - 5.4 - i386-bin-1of6) file> continue> drop down lists, I choose LINUX as operating system and Red Hat Enterprise Linux 5 as my Version> continue-> finish (no customization settings). It appears the screen of CentOS and I am invited by a text asking me if I want to install in text or graphics mode. (Don't know what to do here, but I select the graph). A bunch of white text scroll a screen of black background, then a blue screen shows up saying: 'Welcome to CentOS' at the top and a gray screen that says "to start testing CD media before installation OK press. Choose Ignore to ignore the media test and launch the installation. "I click on the red button (even once, if it is incorrect, let me know). A few rows of white text on black background (from anaconda... something on a video card...) then a nice graphic display of CentOS which I click NEXT. I then select English as my tongue (twice) and I gives me the message:

    "The partition table on device sda (VMware, VMware Virtual S 20473 MB) was unreadable. To create new partitions, it must be initialized, cauing the loss of all DATA on this drive. This operation will replace all choice on what players to ignore previous installation. You would like to initialize this drive, erasing all THE DATA? »

    I have no idea what to do here. I googled the message and others have been too, but they can talk about some hard file (and I have no idea what it is, and I can't seem to find mine).

    I can't lose what's on my hard drive (my school, music, photos, applications, files etc.). Clicking YES will erase my HD? I'm terribly afraid. I need to get this thing installed so I can do my operating systems class work, but I don't know if I did the installation correctly so far and especially, what to click at this point. Can someone help me out please (I spent 4 hours on this one today. "I have no one else to ask)? Finally, the installation is almost done after this step?

    Any help at all would be so greatly appreciated.

    I do not use Fusion, but I have VMware Workstation on Windows. I went through the same process that you went through. The answer to your question is that when you choose the operating system you install and you choose the option for the installation disc, it creates a virtual hard drive for you, size 20 GB. When they ask you to erase the hard drive, it's clear that virtual you create, not your actual computer hard drive. You can check by looking at the properties of the hard drive on your computer. It's probably 250 GB or 500 GB or something big like this. The CentOS WARNING speaks of a 20 GB hard drive, which is the size of the disk that VMware Fusion (and Workstation) create for CentOS.

  • I am trying to install my license in volume from one computer to the other. My serial number is displayed as incorrect when I type in to my new computer?

    I had CS 5.5 on a computer for about 6 years. I want to transfer to my new computer. Told me the key I is a volume license key. I downloaded 5.5 on my new computer from Download Adobe Creative Suite 5.5 products. He tells me is not valid when I go in during installation.

    False alert guys. The series has not worked because it was for Production Premium and I had downloaded Design Premium. Sometimes I'm a dingus.

  • BlackBerry Q10 unknown number

    I have a Q10 of Bell Aliant in the Canada.  I have the latest version of the software.

    When I use the phone, the top of the screen, it says 'Unknown number' and 'my blackberry' in this.

    I saw some patches for this one where you can go to the SIM card and enter the information, but that doesn't seem to be available on a Q10.

    Suggestions or settings should I see?

    The displayed number is associated with the SIM card, as you may know. If there are no parameters to display him, Bell Aliant should be contacted (e) that they control everything related to the SIM card.

    See you soon.

  • Conversion of the binary representation of a number

    Hello

    Is there a function any in PL/SQL which could convert a number to its binary representation? Data type that results would be VARCHAR2.

    So, for example if I have the number whose value of 9 then I need 1001 as well.

    I tried to find this in formatting TO_CHAR models but found nothing.

    Thanks for the help,

    Dan

    It's playtime!

    Re: Decimal to binary

  • ORA-00904 invalid identifier with the insert command

    Please inform me of what's wrong with insert.




    Declare
    cursor c1 is
    Select column_name as Column_namee, data type data_type, data_length as datalen ALL_TAB_COLUMNS where table_name = upper('ALI');
    temp_col_names varchar2 (1000);

    BEGIN
    for j in loop c1

    temp_col_names: = temp_col_names | j.column_namee | «, » ;

    end loop;
    Select substr (temp_col_names, 0, length (temp_col_names)-1) in the double temp_col_names;

    dbms_output.put_line (temp_col_names);

    INSERT INTO temp_col_names (temp_col_names) SELECT id WHERE Ali ali2 = 4;


    END;

    This means that there is no temp_col_names of the column in the table ALI2. Looks like you are the dynamic SQL search - you want to insert all the table columns ALI in the same set of columns in table ALI2, right? Then use:

    EXECUTE IMMEDIATE ' INSERT INTO ali2 (' | temp_col_names |) ') SELECT ' | temp_col_names | "Ali WHERE id = 4';

    SY.

  • [nQSError: 43119]:-the data type: 25 is not supported columns error for data type "uniqueidentifier".

    Hi all


    I am facing a problem while creating a BI reports to the SQL Server 2008 Database.

    Access to columns of data type "uniqueidentifier" I get error [nQSError: 43119]:-the data type: 25 is not supported.

    • OBIEE 11.1.1.6.11 on Linux x86_64 servers is hosted by the Services of Oracle Cloud.
    • Using last "ODBC driver for SQL server 11" for connection (also tried driver "DataDirect SQL Server 6.0 native Wire Protocol").
    • No "Uniqueidentifier" data type columns display correctly in reports.
    • I tried to change the columns of data type "Uniqueidentifier" to char (36), VARCHAR (36), VARCHAR (40), types of binary data (16) in the physical layer on various suggestions but error still there.

    Same columns questioned the SQL Developer (using third-party jTDS JDBC driver "jtds - 1.2.7 - dist") I am able to see these "uniqueidentifier" data columns. record sample:-"CB350576-FCD8-DE11-B111-002219598619".


    Please advice if this is a bug or I'm missing some property of SQL server database settings.


    Thanks in advance.

    Yes Srini,

    This type of column becomes UNKNOWN when they are imported into SPR but its strange after changing to VARCHAR (36), we can use it for joining tables without any problem.

    Only issue I'm facing now is the limitation to use in queries like calculate the total number of incidents (in my case incidentid is the primary key).

    But I've found a workaround. I am formulating a measure in MDB layer to get the number of total incidents as {CASE WHEN is NULL then 0 otherwise 1 END}.  the aggregation is defined on the sum and I get incident count works correctly.

    Thanks for your help.

  • CHD: the string is used as an index of change in data type? String to double?

    Hello

    I'm new to the tiara. I'm reading the line of a channel number and then to read the data of a channel which is in the same line of another channel.

    That's why I use the SMC function but my index seems not to fit. What I need to change in the code?

    error:

    CHD (2, NOVALUE): = 785 wird die Textvariable «...» CHD (2, > N)

    Code:

     

    DIM intloop, zeilenwerte
    Line DIM, aktwert, index
    Call ChnAlloc ("zeilenwerte", lang, 1, DataTypeFloat64) ' Create channel, 'lang' is the size of a channel
    index = 0
    index = 1 to lang
    index = index + 1
    aktwert zeit (index) = ' get the value that will be compared to the SOPS in the following line of code
    Line = PNo (myChannel, aktwert) ' it returns the line only by comparing aktwert valued myChannel
    CHD (line, zeilenwerte) = intloop ' <--->here the error. try to get the value in a line @index do String data types does not match? what do I do then?
    Next

    Thank you very much for your help!

    Buddhist salvation,

    It seems to me that you would be better to use "Linear Mapping" in the palette of ANALYSIS "Suitable curve", but you should be able to get your code works by passing the name of the channel in this second parameter instead of an empty string variable.  You would have noticed that if you had OPTION EXPLICIT the first line of your code - always a good idea.

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • The multiplot XY graphs &amp; Data Types

    Currently working on four tracing data sensors of pressure on a XY plot, but up to this impossible. In addition, I do not know if I use the correct data type.

    As you can see in the image below, my code is taking measures of the DAQ Assistant and proceeds to divide the data into four signals before taking their average. My predecessor was thought to build a matrix of these signals of four split with what I suppose is the timestamp. The problem is that only one set of data being plotted right now. I tried to change the order of things that I use a cluster as my data type, but I always feel to get an error.

    Recently I saw this webpage https://decibel.ni.com/content/docs/DOC-5129 for more help, but imitating the way they don't seem to work for my code.

    Can anyone help?

    All I see are 1 d arrays. A matrix in LabVIEW is special data type used for... you guessed it, matrix calculations. Do not use it interchangeably with table.

    The main problem is that you send a single cluster in the XY graph, which means a single parcel. What you want is an array of clusters. The clusters will be a beam of table 1 d of timestamps and D 1 table of measures. But it is the hard way to do it, and this means you need to keep all your data as the tracks of the loop, with a lot of unbundling, build tables and rebundling. Crossrulz wrote a great nugget on How to use a sporadic data graphic , which makes things much easier, because the chart holds the story for you. Take a look at this post, and if you want to have several plots, you can just make a table of the waveforms, as I did below. Where you see the 'random number' dice, you will put your unique measurement data you acquire every time as the iteration of the loop. You can test the program by running and clicking on the Add Point"" button.

  • Modification of the data types of the custom shared variables

    My application includes a library containing a number of shared single process variables. I use type defs to create the shared variable "of the custom control." I know that shared variables do not-automatic update since the type defs, so I'm updating shared variables (data type, do a right click, properties) whenever I update the type definitions.  However, if I make a change to a type design that does not change the data type, for example to change the labels controls, these changes will be reflected in the shared variable.  The data types of variable window shared list contains entries for each previous update, which indicates he uses the previous entries.  How can I make the window of properties of shared variables 'forget' my previous defs type wandering without deleting the variable total? Withdrawal and replacement would be troublesome because the done variable references throughout my project.

    Thank you

    Wes

    The variable is not in the Distributed System Manager, or Manager of the Variable, and cancellation of the deployment has not been resolved.  However, I found Labview from closing completely and reboot clears the memory of the previously used custom data types that sees the library.  Thus, the effective workaround I found is:

    1 make a significant change to the data type of the type (per your suggestion) FED. Record.

    2 - redefine the variable screw-notice type FED.

    3. save the project. Close and restart labview.

    4 - the old def type is now disabled.

    5. return the significant change of the def type, implement trivial change and save.

    6 redefine the variable using the type correct now def. Viola!

    Thank you!

  • Removal of the custom by TestStand 4.0 data types

    Hello! I use the custom in my TestStand sequence data type. This data type is derived from my own control and is a huge cluster of clusters. It is created in a file of sequence (and not in any *.ini). By changes in the sequence, it becomes necessary to delete existing custom data type and create a new one due to changes in the custom control. How can I remove custom data types?

    I n ' found any possibility to do in Teststand menus. It was not so important, if the custom data type was not so huge.

    Thank you in advance for your answer - maybe it's a workout if no direct solution?

    Hello

    Just see the Type of data in the file in the sequence and highlight the custom data type it, then delete it.

    (Please make sure that you do not have variables defined in your file of sequence that still use the data type you want to remove).

    Concerning

    Ray Farmer

  • Resolve the conflict of data type of TestStand pragmatically in CVI

    Hello

    I'm porting a UI for the 2010 ICB/TestStand.  My problem with the badly planned spread data types defined custom.  While I can handle the MyTypes.ini and StationGlobals definitions, sequences that we are loading are originally the dialog box 'Type to the Type of conflict'.  The sequences that are loading have been created in previous versions of TestStand (3.1 and 4.0 for the most part).  The main reason why a 'conflict' is detected because the data types of the sequences can either have different indicators (for example, "modified") or updated dates.  The structure of the types are ALWAYS the same, so there is no danger by choosing the "wrong" data type  However, given that the "currently loaded" Type is one that "must" always be used, it would be great if the resolution could be resolved so that the operator never has to see the dialog box.  In our environment of manufacturing of these dialog boxes are considered errors.

    There are hundreds of files in sequence that could be affected.  The process to go through each of them individually and setting data types would be impractical (really, out of the question).

    I use TSUI_ApplicationMgrOpenSequenceFile() to open the sequence and can not find a way to settle the conflict resolution to automatically choose the "currently loaded.  Please let me know if there is a way to do it, and if so, provide an example.  Any other suggestions you might have would be welcome.

    Thank you

    JF

    (Either by the way - I meant "programmatically", not "pragmatic" in the subject heading)

    I tried your suggestion and I still get the dialog box when

  • using case, but by changing the data type of diff

    Hi guys, I am creating a view and selecting in a column that has a value of-1, 0 or 1, it's very good and I was about to use a case statement to convert the - 1 to "n", but obviously I can't do what data types do not match, I can't change the data type of the original column until someone knows how I could achieve This or a similar output, for example, is there a way to add an extra column to the view and just copy the numbers to the horizontal except for when it is - 1, we will copy a "n" throughout. the new column might be char and we could convert the numbers to a char when their through copying. Is it possible to do and if so could someone explain or give me an example of how to do it.

    Thank you.

    An alternative to the above:

    case when col1 = -1 then 'N'
         else to_char(col1)
    end
    
  • Need help with the insert statement

    Hello

    I have a question on how to write a SQL statement.

    This is the table of "base":
    CREATE TABLE TEMP_TBL
    (
    id_nr NUMBER,
    DATE_DOK DATE,
    DATE_DUE DATE,
    DATE_DOK_PAY DATE,
    DEB NUMBER,
    KRD NUMBER
    );
    
    insert into temp_tbl (ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('1',TO_DATE('11.01.2011','DD.MM.YYYY'),TO_DATE('25.02.2011','DD.MM.YYYY'),NULL,'423,24','0');
    insert into temp_tbl(ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('2',TO_DATE('16.12.2011','DD.MM.YYYY'),TO_DATE('13.06.2011','DD.MM.YYYY'),NULL,'91270,15','0');
    insert into temp_tbl(ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('3',TO_DATE('27.09.2011','DD.MM.YYYY'),TO_DATE('27.09.2011','DD.MM.YYYY'),NULL,'0','2000');
    and it comes to resoult in the target table. SQL statement must take care of the insert in a base of the target table table (example below is already provided with test data).
    create table table_sod
    (
    
          id_nr number
         ,date_from date
         ,date_to date
         ,deb_krd number
    
    );
    
    One thing to note here :  values in column deb_krd under insert 1 and 4 must be summarized in insert 4.
    
    insert into table_sod (id_nr,date_from,date_to,deb_krd) values('1',null,to_date('25.02.2011','dd.mm.yyyy'),'423,24');
    insert into table_sod(id_nr,date_from,date_to,deb_krd) values('2',to_date('26.02.2011','dd.mm.yyyy'),to_date('13.06.2011','dd.mm.yyyy'),'423,24');
    insert into table_sod(id_nr,date_from,date_to,deb_krd)values('3',null,to_date('13.06.2011','dd.mm.yyyy'),'91270,15');
    insert into table_sod(id_nr,date_from,date_to,deb_krd)values('4',to_date('14.06.2011','dd.mm.yyyy')to_date('27.09.2011','dd.mm.yyyy'),'91693,39');
    insert into table_sod(id_nr,date_from,date_to,deb_krd)values('5',null,to_date('27.09.2011','dd.mm.yyyy'),'2000');
    If someone could give me a helping hand how write correct insert statement I would be really gratefull.

    Thank you for your time!

    I came here with my own assumptions with this

    SQL> select rownum id_nr
      2       , date_from
      3       , date_to
      4       , case when date_from is null then deb
      5              else sum(case when date_from is not null then deb else 0end) over(order by id_nr, no)
      6         end deb_krd
      7    from (
      8            select id_nr
      9                 , case when lg_dt is null or ld_dt = date_due then  null else lg_dt+1 end date_from
     10                 , ld_dt date_to
     11                 , case when deb = 0 then krd else deb end deb
     12                 , no
     13              from (
     14                      select t1.*
     15                           , lead(t1.date_due) over(order by t1.id_nr, t2.no) ld_dt
     16                           , lag(t1.date_due) over(order by t1.id_nr, t2.no) lg_dt
     17                           , t2.no
     18                        from temp_tbl t1
     19                       cross
     20                       join (select 1 no from dual union all select 2 no from dual) t2
     21                       order by id_nr, no
     22                   )
     23             where ld_dt is not null
     24         )
     25  /
    
         ID_NR DATE_FROM DATE_TO      DEB_KRD
    ---------- --------- --------- ----------
             1           25-FEB-11      42324
             2 26-FEB-11 13-JUN-11      42324
             3           13-JUN-11    9127015
             4 14-JUN-11 27-SEP-11    9169339
             5           27-SEP-11       2000
     
    

Maybe you are looking for

  • Update via subject: Firefox after the release date

    I noticed that in the latest versions of 4-6, after the official release date (for example today Firefox 38.0 was moved to release and pushed to free servers and for manual download on the site) as the day coming on: firefox does not update the progr

  • The mouse is frozen

    While I was updating my norton anti vrius my mouse froze and was unable to complete the update. I rebooted, disconnected & repluged and nothing is free. Can help a means?

  • Computer disconnects after short idle

    If I do nothing on my desktop for about 5 minutes, I need to log in again.  Can I change the timeout of 1/2 hour?

  • Help avast

    I uninstalled AVG Antivrus ato try Avast Antivirus. I need some helpp understand this program. The fist how do you run the updates. My Windows Securty alert tells me that Avast needs to be updated, but I can't find a place to update this program. How

  • Keys on a white background and track 3d movement

    It is actually two questions, so if I need to split it into 2 posts, I can do.First of all, I have my talents on a white background (because of the green in costume) and I want to put a background behind them is a picture of a track or a stage (see t