PL/SQL to return at the beginning of a table/reset value

Hello

My last task is to have a set of view 1 page of data every n seconds, for example data on each database. The table contains a PK that defines the order. Now if I have 15 databases (unknown number) how can I reset it to 1 when I arrived at the end? I also reset the element name of DB. That's what I try with a PL/SQL procedure (before the regions):
begin
IF (select 1 from monitor_status 
where DB_MONITOR_PK = :P2_HIDDEN_DB_NM) = 0 then
:P2_HIDDEN_DB_NM := 1;
--select db_name into :P2_DBNAME from monitor_status
-- where DB_MONITOR_PK = 1;
end if;
end;
The idea is if there is no line with the PK then go back to the first, but he complains to select it in the IF statement :(

Mike

GERD wrote:
Hello

My last task is to have a set of view 1 page of data every n seconds, for example data on each database. The table contains a PK that defines the order. Now if I have 15 databases (unknown number) how can I reset it to 1 when I arrived at the end? I also reset the element name of DB. That's what I try with a PL/SQL procedure (before the regions):

begin
IF (select 1 from monitor_status
where DB_MONITOR_PK = :P2_HIDDEN_DB_NM) = 0 then
:P2_HIDDEN_DB_NM := 1;
--select db_name into :P2_DBNAME from monitor_status
-- where DB_MONITOR_PK = 1;
end if;
end;

The idea is if there is no line with the PK then go back to the first, but he complains to select it in the IF statement :(

Yes, it is not valid in PL/SQL.

Assuming that P2_HIDDEN_DB_NM is is incremented (from observation "when I came to the end"), where and when is it? Cannot be reset it?

Use an exception no_data_found handler:

begin

  select
      :p2_hidden_db_nm
  into
      :p2_hidden_db_nm
  from
      monitor_status
  where
      db_monitor_PK = :p2_hidden_db_nm;

exception

  when no_data_found
  then
    :p2_hidden_db_nm := 1;

    select
        db_name
    into
        :p2_dbname
    from
        monitor_status
    where
        db_monitor_pk = :p2_hidden_db_nm;

end;

Tags: Database

Similar Questions

  • How can I return at the beginning of the current selection?

    The hearing 3 and earlier versions, if I wanted to hear the audio selected, I made the selection in the Waveform Editor, you press Play and the selection would play.  He would play the same selection again if I stopped reading and press Play again.  CS5.5 and 6 that appears not to work the first time you press Play after selecting some audio.  After that, the audio is just resumes since when he arrested him.

    Is it possible to get the current time indicator to return at the beginning of a selection?

    Robert

    I find that it is quite consistent in his behavior. But if you want to study the possibilities, go in Edition > Preferences > reading and you have several options of course altering it.

  • Configuration of the loops in LabVIEW to return to the beginning under certain conditions of CRC calculation

    Hey gurus of LabVIEW,.

    Well, I recommend also move your file in writing to be inside the loop, more precisely inside the TRUE (I could bad told you before).  If the CRC was released in 0, do you all the processing, otherwise do nothing.  Then the next iteration.  By moving the file i/o inside the loop, you're avoiding accumulate huge berries (IE a lot of memory).

  • The search in a table a value then delete this array element

    Hello.

    I have an array of VO (id, link, title, url...) I want to get an ID of this array element and remove the element with the corresponding id. Any thoughts on how I would go to this topic?

    Thanks in advance!

    Ryan

    I don't know much on your and this probably isn't the most elegant solution, but you can do something like:

    for (var i: Number = 0; i<>

    {

    If (myVOArray [i] ["id"] is "someId")

    {

    myVOArray.splice (i, 1);

    }

    }

  • pl/sql block returning the sql query.

    Hello

    I'm using the apex version 3.2 oracle 10g.
    I use the following return statement inside my report, which is a pl/sql block sql query return.

    declare
    The NEST varchar2 (100);
    Start
    ......
    return "select patient_id_code from t_files_data_exp, including patient_id_code not in the NEST';"

    end;

    How am I suppose to mention the pid within the return stmt I mean with quotes or anything? because the above return stmt gives error
    "1 error has occurred."
    Query cannot be parsed in the generator. If you believe that your query is syntactically correct, check the generic "columns" box below the source of the region without analysis. The query cannot be parsed, the cursor is not yet open or a function returning a SQL query returned no value. »


    Thank you

    If is varchar2

    declare
    pid varchar2(100) := '(''61092'',''61093'')';
    ...
    
  • How to return to the position after recording Garageband?

    After recording something in Garage band, he returned at the beginning, I have to press return on the keyboard, how can I do it automatically go to the beginning or when I want to record from?

    If you turn on the Cycle region, GarageBand will always loop to the beginning of the sequence in a loop while recording.

    If not, see the list of shortcuts here: http://help.apple.com/garageband/mac/10.1/#/gbnd715f33a0

  • Qosmio F60 trying to return to the factory settings

    Hi all

    I recently purchased a Qosmio F60. When I started it upward and the preload Windows 7 has started to install, I clicked on the option for 64-bit. A few days later, after the installation of a few other programs I noticed in configuration/system board that windows was reported as 32-bit. (Yes, I'm sure that I chose 64-bit). He noted also that 4gig ram withonly 2.98 usable.

    First of all, can someone explain why this could be?

    I had not created a recovery disk because I planned to load the machine with all the programs that I use regularly and THEN create the recovery disk and image. However now that I see that windows is apparently loaded as 32 bits I want to return to the beginning and reload the windows preinstalled as 64-bit. I really need it to make full use of the suite cs4 Adobe. And I'm confused as to why only three-quarters of my ram is usable.

    I backed up the data (a little), I've created so far and the TOSAPINS file and put it on a USB key. What is the best way to restore it to how it was when I got it out of the box? It came with preloaded trial of Office 2007, and Norton, versions.

    If I go back to the system default Toshiba Restore Point will it take me back to where I re - load Windows? Or is it just restore point after installing windows?

    Thanks in advance

    ufoundlou

    Hello

    Can you please tell us what F60 (F60 - xxx) have you exactly.
    It is really strange that you have it with 32-bit because I know with certainty that this machine comes with 64-bit only.

    To be honest, there is no sense to install 32-bit on such portable high-end with excellent material. Please try to install the recovery image using HARD drive recovery procedure. Procedure is described on http://aps2.toshiba-tro.de/kb0/HTD9102IR0000R01.htm

    Please note:
    When you want to create the recovery DVD you will get recovery on that image if all applications that you will install in addition will appear not in this recovery image.

  • Hide TOC when the user navigates to the beginning of the same blade

    Hello

    I have a project that includes a series of clips video (each clip is on a transparency) and the user must watch all the videos to complete the course.  Therefore, we took the scroll bar, forward, fast forward, etc. from the PlayBar and also don't allow navigation to the slides that have already been viewed.   I have each slide set to hide the table of contents at the entrance so that when they use the table of contents to go back and review a slide, they have to close.  Works great, except when a user decides that they were not paying attention, or for any other reason, they want to return at the beginning of the slide they are displayed.  Then, when they use the table of contents to the beginning of the same blade that they are on the books of navigation, but the table of contents is not hidden.  For users, this is considered as an inconsistency and as if something is broken.  Is it possible for me to trigger an action automatically to say the second 1 mark to close the table of contents?

    I am using Captivate 7.0.1.237 on a Mac Pro, running the Mavericks.

    Thank you

    Walter

    Captivate has no way by default to do.  Using the table of contents to return at the beginning of the same blade you DO NOT enforce the event on slide enter again.  If you enter the slide to ANOTHER slide, which fires.

    There is a free widget that allows you to perform advanced time-based actions:

    http://www.Infosemantics.com.au/widgetking/the-widget-pages/

    However, this widget may not work in any version after Cp6.1:

    http://captivatedev.com/2012/09/26/Adobe-Captivate-6-0-free-widget-time-based-actions/

    So it's a SWF widget not compatible with HTML5

  • Return of the miniature fullscreen

    In previous versions of elements, when I left the mode full-screen image, I returned to this same image in miniature. In the 11 elements, I returned at the beginning of the folder in which the image is stored. Is it possible to return to the thumbnail, I started with when I went full-screen?

    I think you can return to the organiser with the selected original image only if you are in the mode of 'all media'... or in an album.

    So you solution would be to create a temporary album with all the photos in your folder and work on this album. In many situations, using the full view (F11) is best done in an album where you can order and select your images freely.

  • How to start a .flv continuous at one point other than the beginning of the video file?

    I have a 1.5 hour flv video that is streaming from a box of Microsoft 2003 with Wowza Media Server installed. In the using Actionscript 3 and the FLVplayback component, I would first of all video on one point about 10 seconds from the beginning.

    This code snippet does not work:

    myVideoFile.seek (10);
    myVideoFile.play ();

    If the video is designed to the appropriate location in the video file, the play() call it returns to the beginning. Thanks for your help!

    It should work, but reverse the declarations

    myVideoFile.play ();
    myVideoFile.seek (10);

  • Return of the bound data control method causes IllegalArgumentException

    JDeveloper Version: _12.1.2.0.0_GENERIC_130608.2330.6668

    Problem:

    I have a Service method on a data control which takes the parameters. I'm able to drag the Service method on a JSF/ADF page and it creates an ActionBinding and all links in the input parameter as well. No problem. I can run the page and enter values in the display, press the binding Action and the method on the façade of the Session is called perfectly. So far so good. Now, I want to display the results of the (returned as a collection of POJO) Service method in the method declaration.

    If I drag the method declaration of data control on the same page and request that the results will be displayed in a table (or any control that will display a collection, in this example, this is a graph) control is created and all links with her. Once again, so far, so good.

    Now I start the page. This time, I IllegalArgumentExceptions (two of them) returned as messages when loading the page. Stack trace looks like this (my apologies, I hate when people put a huge stack traces in positions):

    [code]

    java.lang.RuntimeException: java.lang.IllegalArgumentException

    at oracle.adf.model.adapter.bean.UpdatableBeanDataControl.invokeOperation(UpdatableBeanDataControl.java:606)

    at oracle.adf.model.adapter.bean.BeanFilterableDataControl.invokeOperation(BeanFilterableDataControl.java:80)

    at oracle.adf.model.bean.DCBeanDataControl.invokeMethod(DCBeanDataControl.java:472)

    at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:266)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1658)

    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2189)

    at oracle.adf.model.bean.DCBeanDataControl.invokeOperation(DCBeanDataControl.java:560)

    at oracle.adf.model.adapter.AdapterDCService.invokeOperation(AdapterDCService.java:309)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:751)

    to oracle.jbo.uicli.binding.JUMethodIteratorDef$ JUMethodIteratorBinding.invokeMethodAction (JUMethodIteratorDef.java:170)

    to oracle.jbo.uicli.binding.JUMethodIteratorDef$ JUMethodIteratorBinding.initSourceRSI (JUMethodIteratorDef.java:659)

    at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1741)

    at oracle.adf.model.binding.DCIteratorBinding.internalGetRowSetIterator(DCIteratorBinding.java:1715)

    at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4684)

    at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)

    at oracle.jbo.uicli.binding.JUCtrlHierBinding.getRootNodeBinding(JUCtrlHierBinding.java:108)

    at oracle.adfinternal.view.faces.dvt.model.binding.common.BindingKeyChangeHandler.setBinding(BindingKeyChangeHandler.java:52)

    at oracle.adfinternal.view.faces.dvt.model.binding.graph.ActiveGraphDataModel.setHierBinding(ActiveGraphDataModel.java:82)

    at oracle.adfinternal.view.faces.dvt.model.binding.common.FacesCubicBinding.getDataModel(FacesCubicBinding.java:194)

    at oracle.adfinternal.view.faces.dvt.model.binding.common.FacesCubicBinding.getDataModel(FacesCubicBinding.java:159)

    at oracle.adfinternal.view.faces.dvt.model.binding.common.FacesCubicBinding.getDataModel(FacesCubicBinding.java:111)

    at oracle.adf.model.dvt.binding.common.CommonBinding.internalGet(CommonBinding.java:149)

    at oracle.adf.model.dvt.binding.common.CubicBinding.internalGet(CubicBinding.java:580)

    at oracle.adfinternal.view.faces.dvt.model.binding.common.FacesCubicBinding.internalGet(FacesCubicBinding.java:234)

    at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:751)

    at javax.el.MapELResolver.getValue(MapELResolver.java:199)

    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)

    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)

    at com.sun.el.parser.AstValue.getValue(AstValue.java:138)

    at com.sun.el.parser.AstValue.getValue(AstValue.java:183)

    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)

    [/ code]

    Now, if I fill in the parameters on the screen and call the ActionBinding by pressing the button created, the method calls the function on the façade and the data is returned in the control (chart or table). From that moment, I never have the illegalArgumentException and the page the way I want it.

    So, my question is, why the return of the method lie I invoke a method call on a page load until the ActionBinding is called and give me an illegalArgumentException. And - most importantly - how can I avoid this error?

    Any advice would be greatly appreciated.


    Thank you

    Nigel

    It is a normal behavior.  Check blog Shay https://blogs.oracle.com/shay/entry/delay_method_execution_when_us

    Timo

  • Doubt to the advanced multiple selection table

    Hello

    I use a table in my page.and I have several columns of the table selection.
    I select several lines and inserts the data into another table.

    My question is when I check the multiple select box and select lines it will redirect to another page.
    and when I return to the selection page of that checkbox values are not resetting.it shows the same values.
    Please let me know how to reset these values or how these values are not checked.


    Thanks in advance
    Bharat

    Bharat,

    Attach a transitional attribute with Multiple selection... instead of any attribute associated with the table.

    Kind regards
    GYAN

  • catch the collection returned by the function in a SQL statement

    I have a select like query: (I need all the values returned by the function in the select list)

    Select t1.col1, t2.col2, (by selecting t.a, t.b., t.c in fn (t2.col3) t)
    Of
    T1, t2
    where t1.col1 = t2.col2;



    My function is like:

    FN (T2.col3) returns an array in format of the object



    Here, I was able to select only one value from the table returned by the funcation both. If I select all of the values as above, she gave too much error vales.
    Please someone help me in this

    user13044793 wrote:
    I have a select like query: (I need all the values returned by the function in the select list)

    Select t1.col1, t2.col2, (by selecting t.a, t.b., t.c in fn (t2.col3) t)
    Of
    T1, t2
    where t1.col1 = t2.col2;

    No specific reason for this? It adds additional complexity to the projection of SQL, and there are additional costs of failover for the motor of PL/SQL (per line) of context. Overall - not your typical approach and one that should have sound justification.

    With regard to the basic method - the SQL multiset() function should be used to create a collection. Here is an example of the approach:

    SQL> create or replace type TFoo as object(
      2          id      number,
      3          bar     varchar2(5)
      4  );
      5  /
    
    Type created.
    
    SQL>
    SQL> create or replace type TFooSet as table of TFoo;
      2  /
    
    Type created.
    
    SQL>
    SQL> create or replace function GetSomeFoo( n number ) return TFooSet is
      2          foo     TFooSet;
      3  begin
      4          foo := new TFooSet();
      5          foo.Extend( 5 );
      6
      7          for i in 1..5
      8          loop
      9                  foo(i) := new TFoo( n+i-1, to_char(i-1,'0000') );
     10          end loop;
     11
     12          return( foo );
     13  end;
     14  /
    
    Function created.
    
    SQL>
    SQL> select
      2          object_id,
      3          object_name,
      4          cast(
      5                  multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      6          )       as FOO
      7  from       all_objects
      8  where      owner = 'SYS'
      9  and        rownum <= 5;
    
     OBJECT_ID OBJECT_NAME                    FOO(ID, BAR)
    ---------- ------------------------------ --------------------------------------------------
         27538 /1000e8d1_LinkedHashMapValueIt TFOOSET(TFOO(27538, ' 0000'), TFOO(27539, ' 0001')
                                              , TFOO(27540, ' 0002'), TFOO(27541, ' 0003'), TFOO
                                              (27542, ' 0004'))
    
         28544 /1005bd30_LnkdConstant         TFOOSET(TFOO(28544, ' 0000'), TFOO(28545, ' 0001')
                                              , TFOO(28546, ' 0002'), TFOO(28547, ' 0003'), TFOO
                                              (28548, ' 0004'))
    
         11718 /10076b23_OraCustomDatumClosur TFOOSET(TFOO(11718, ' 0000'), TFOO(11719, ' 0001')
                                              , TFOO(11720, ' 0002'), TFOO(11721, ' 0003'), TFOO
                                              (11722, ' 0004'))
    
         30094 /100c1606_StandardMidiFileRead TFOOSET(TFOO(30094, ' 0000'), TFOO(30095, ' 0001')
                                              , TFOO(30096, ' 0002'), TFOO(30097, ' 0003'), TFOO
                                              (30098, ' 0004'))
    
        684122 /1023e902_OraCharsetUTFE       TFOOSET(TFOO(684122, ' 0000'), TFOO(684123, ' 0001
                                              '), TFOO(684124, ' 0002'), TFOO(684125, ' 0003'),
                                              TFOO(684126, ' 0004'))
    
    SQL>
    SQL> with dataset as(
      2          select
      3                  object_id,
      4                  object_name,
      5                  cast(
      6                          multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      7                  )                as FOO
      8          from    all_objects
      9          where   owner = 'SYS'
     10          and     rownum <= 5
     11  )
     12  select
     13          d.object_id,
     14          d.object_name,
     15          f.id,
     16          f.bar
     17  from   dataset d,
     18          table(d.foo) f
     19  /
    
     OBJECT_ID OBJECT_NAME                            ID BAR
    ---------- ------------------------------ ---------- ---------------
           217 DUAL                                  217  0000
           217 DUAL                                  218  0001
           217 DUAL                                  219  0002
           217 DUAL                                  220  0003
           217 DUAL                                  221  0004
           268 SYSTEM_PRIVILEGE_MAP                  268  0000
           268 SYSTEM_PRIVILEGE_MAP                  269  0001
           268 SYSTEM_PRIVILEGE_MAP                  270  0002
           268 SYSTEM_PRIVILEGE_MAP                  271  0003
           268 SYSTEM_PRIVILEGE_MAP                  272  0004
           271 TABLE_PRIVILEGE_MAP                   271  0000
           271 TABLE_PRIVILEGE_MAP                   272  0001
           271 TABLE_PRIVILEGE_MAP                   273  0002
           271 TABLE_PRIVILEGE_MAP                   274  0003
           271 TABLE_PRIVILEGE_MAP                   275  0004
           274 STMT_AUDIT_OPTION_MAP                 274  0000
           274 STMT_AUDIT_OPTION_MAP                 275  0001
           274 STMT_AUDIT_OPTION_MAP                 276  0002
           274 STMT_AUDIT_OPTION_MAP                 277  0003
           274 STMT_AUDIT_OPTION_MAP                 278  0004
           815 RE$NV_LIST                            815  0000
           815 RE$NV_LIST                            816  0001
           815 RE$NV_LIST                            817  0002
           815 RE$NV_LIST                            818  0003
           815 RE$NV_LIST                            819  0004
    
    25 rows selected.
    
    SQL>
    
  • conditional view using body of the Pl/SQL function returning a Boolean

    I have problems with the conditional display of a report.

    I have to select list: p50_facility and p50_supervisor.

    I entered the Sub function body of pl/sql returning a Boolean

    Begin
    If (: p50_facility is null or)
    (: p50_supervisor is null) THEN
    Return False;
    On the other
    Return True;
    End if;
    End;

    No matter what values are my articles on (null, not null), the report shows.

    What I am doing wrong?

    Hello

    The list values will be null only until the first time that the page is sent. Subsequently, the value is likely to be "null %."

    You should do something like:

    BEGIN
     IF (:P50_FACILITY IS NULL OR :P50_FACILITY = '%' || 'null%' OR :P50_SUPERVISOR IS NULL OR :P50_SUPERVISOR = '%' || 'null%') THEN
      RETURN FALSE;
     ELSE
      RETURN TRUE;
     END IF;
    END;
    

    Andy

  • Query HTTP GET returning always with '? ' at the beginning

    Hi all

    I did experiment with the display of HTML content in a BrowserField (5.0) two different ways:

    1. With the help of browserField.requestContent (url);
    2. Retrieve the HTML of "url" using a HTTP GET request and then displaying the HTML retrieved with:
    browserField.displayContent(response, http://localhost);
    

    I would use the method #2 because I want to be able to cache the HTML source in a persistent storage. However, for some reason when I use the #2 method, the HTML returned by the HTTP response contains a '? ' at the very beginning of the response/html:

    ? Founded in 2008, ...
    

    I concluded that the problem is not with my .html page.  The question mark seems to be introduced during the HTTP request/response.  However, when I use the same method #2 to a different URL, say from google.com, the source is returned without an exclamation mark.

    Any ideas?

    I'll just be brief here, because I think you might be capable of that worked for yourself and therefore save me time...

    I suspect that you have a BOM - Byte Order mark, which is used by some Web sites, search wikipedia for more information.

    Anyway, you really want to convert html get UTF - 8 and then give the string to the browser field, because it is not converted into UTF - 8 correctly.  So I suspect that you can only receive input html in the form of bytes, including the Board of Directors and pass directly through to the BrowserField.

    See this thread for more information:

    http://supportforums.BlackBerry.com/T5/Java-development/displaying-UTF-8-string-problem-in-browserFi...

Maybe you are looking for