problem with loop statement

Hello

I'm new in plsql, so I need your help. I am rewriting the existing plpgsql function plsql function, but I have an error on line 15: PLS-00103: encountered the symbol "LOOP" when expecting one of the following values:

What is the problem with the LOOP statement?

FUNCTION to CREATE or REPLACE dothework (service_name text string_value)

RETURNS the text AS

BEGIN

DECLARE

result text;

varying (31) of tempId character;

tempFieldId bigint;

text of tempStringValue;

tempCount bigint;

BEGIN

result = ";

FOR IN tempId

SELECT ce.id FROM mfc.card_element this

WHERE the ce.name AS service_name

LOOP

tempCount = 0;

SELECT INTO tempFieldId mfc.card_field CF field_id

WHERE cf.field_name = 'NPAname ';

SELECT INTO tempCount count (*) FROM mfc.card_element_field_value cefv

WHERE the cefv.card_element_id AS a tempId AND field_id = tempFieldId;

IF tempCount = 1 THEN

UPDATE mfc.card_element_field_value

SET field_string_value = string_value

WHERE the card_element_id AS a tempId AND field_id = tempFieldId;

result: = result | tempId | 'UPDATE - YES,';

ELSIF tempCount = 0 THEN

INSERT INTO mfc.card_element_field_value (id, field_date_value, field_integer_value, field_string_value, card_element_id, field_id)

VALUES (HIBERNATE_SEQUENCE.nextval,

NULL,

NULL,

string_value,

tempId,

tempFieldId);

result: = result | tempId | "INSERT - YES, ';

ON THE OTHER

result: = result | tempId | "tempCount,";

END IF;

-END IF;

END LOOP;

RETURN result;

END;

END;

I did the same refatoring I program you unit and put comments to help to understand.

Let me know if it help you

FUNCTION to CREATE or REPLACE dothework (service_name in VARCHAR2

string_value IN VARCHAR2) RETURN VARCHAR2 AS

-Not necessary to define the new block here BEGIN-

-SAYS - you only need the instruction stated in this case if you

-believe that he can raise one exceptional and you want to manage block outsider

--

-You must set the buffer of varchar2

-32767 is the largest amount

RESULT VARCHAR2 (32767).

--

-You can dock this type for the column type, you will receive the data

tempfieldid card_field.field_id%TYPE;

-tempstringvalue VARCHAR2; -you do not use this variable

tempcount NUMBER;

BEGIN

-You don't need to initialize with NULL, in this case. PLSQL has done already for you

-THE RESULT: = ";

--

-It seems to me that this request can be outside of the loop

-Once the table is not the change and the predicate doenst change is

SELECT field_id

IN tempfieldid

Card_field FC

WHERE cf.field_name = 'NPAname ';

--

FOR tempid IN (SELECT ce.id

OF card_element this

WHERE the ce.name AS service_name) LOOP

-It is not necessary to initialize this variable to zero

-tempcount: = 0;

--

--

SELECT COUNT (*)

IN tempcount

OF card_element_field_value cefv

WHERE the cefv.card_element_id AS a tempid

AND field_id = tempfieldid;

--

IF tempcount = 1 THEN

UPDATE card_element_field_value

SET field_string_value = string_value

WHERE the card_element_id AS a tempid

AND field_id = tempfieldid;

RESULT: = RESULT | tempid | 'UPDATE - YES,';

ELSIF tempcount = 0 THEN

INSERT INTO card_element_field_value

(id

field_date_value

field_integer_value

field_string_value

card_element_id

field_id)

VALUES

(hibernate_sequence.nextval

NULL

NULL

string_value

tempid

tempfieldid);

RESULT: = RESULT | tempid | "INSERT - YES, ';

ON THE OTHER

-I remove the tempCount on the "because I think you want to see the number of records

-you do business with

RESULT: = RESULT | tempid | ' ' || tempCount | ', ';

END IF;

END LOOP;

RETURN RESULT;

-END;

END;

Best regards

Tags: Database

Similar Questions

  • Problem with the State showed up in BB10

    Hello

    After the upgrade of my DevAlpha to the latest version, 10.0.9.1675, I have problems with 2-State buttons.

    Example code:

    #myBtn{
        background-image: url(btn/myBtn.png);
        background-repeat: no-repeat;
        background-position: 0px 0px;
    }
    #myBtn:hover{
        background-position: 0px -124px;
    }
    

    So, when I click the button it stay frozen until steady-state, does not return to the default position. All my apps of ww are affected by this problem.

    Anyone can attempt to reproduce this problem?

    If so, what is the solution?

    This is sort of the standard: hover behaviour I noticed in mobile browsers. Since then no cursor, hover is only simulated.

    The simplest solution (and the one I use in my projects) is to use: active instead of: hover.

    #myBtn:active{
        background-position: 0px -124px;
    }
    
  • Problem with diagram State Toolkit 1.0 - LV 8.2 upgrade to 2014

    I'm in transition a large amount of code from Labview 8.2 to 2014, and I'm having a problem with state diagrams have been added using the state diagram Toolkit V1.0.

    The figure below shows the question, Labview knows the loop and its components are associated with a state diagram, but it option to change the schema, "change the state diagram," is not available.  In Labview 8.2, which I am currently running on older machines, I would simply select "Change the state diagram" and another window of each State and arrows between States appears, allowing the mounting of the diagram.

    I think I have to install the state diagram Toolkit V1.0 software, but it is no longer available on the Web site of NOR.  There are new States transitions module I installed, but it is significantly different from the old Toolbox and does not support.  Any recommendations?

    Thank you very much
    Phil

    Good news:

    (1) SDE still works with SP1 LV2014.

    (2) I have the installer and I'm ready to send it to you. Please send me a private message with your email address.

    Be sure to support this idea.

  • Problem with Decode statement

    Hello

    I try to do the following in my report:

    If an employee is a family name. (dot) or a name of. (dot), the report does not display a point. An employee name consists of the family name, first name and middle name, which should all be concatenated sets. An attempt to achieve this goal, I have the following statement in my report:

    Decode (e.Surname, '.', (LTRIM (RTRIM ((INITCAP (e.FIRST_NAME))) |))) » '|| INITCAP (e.MIDDLE_NAME))),
    e.FIRST_NAME, '.', (LTRIM (RTRIM ((INITCAP (e.Surname))) |)) » '|| INITCAP (e.MIDDLE_NAME))),
    (LTRIM (RTRIM ((INITCAP (e.SURNAME))) | ',' |)) INITCAP (e.first_name) | » '|| INITCAP (e.MIDDLE_NAME))) as emp_name

    E employee

    Problem: The above statement only works for employees with the name of. (dot). It doesn't for the first names of dot. How to use the decode statement OR is there another way to do it without using the CASE statement?

    It seems my decode statement does not work with 2 different fields (name, first name) tested within the decode statement. Thank you.

    LTRIM and RTRIM the comma too:

    select rtrim(ltrim(rtrim(ltrim(', Somename ,',','),','))) Name
    from dual;
    
    NAME
    --------
    Somename
    
  • problem with if statement

    I have problem with this code haven. It shows error illigical use of the else statement. I checked the syntax is at but I don't where is my problem

    I have a drop drop list box. If the user selects objects in textfields txt_contract1 & txt_contract2 of named values has the new change.iam of java script. is it possible to programmetically edit from vb.net. IAM familiar with it.

    DataRoot. Transmittal_pdf. DropDownList1::click - (JavaScript, client)

    If

    (xfa.event.newText == 'Strategic') { }

    XFA. Form.DataRoot._Transmittal_pdf.

    DataRoot._Transmittal_pdf. Table5.row2.txt_contract1. Value

    = "Blueprint of strategic roads."

    DataRoot._Transmittal_pdf. Table5.row2.txt_contract2. Value

    = "These immediate plans."

    }

    on the other

    {

    DataRoot._Transmittal_pdf. Table5.row2.txt_contract1. Value

    = "Held consultation projects;

    DataRoot._Transmittal_pdf. Table5.row2.txt_contract2. Value

    = "";

    }

    Hi Prasad,

    'V' should be in the rawValue capital 'V' instead of small "v". So, it should be rather than rawvalue rawValue.

    Thank you

    Sidonie.

  • Problem with looping his buffer

    Hello.

    Firstly, sorry if a similar topic exists elsewhere, I have tried searching everything but couldn't put my finger on what I wanted, so I'm doing this topic.

    I teach flash at home with the help of the Internet. I'm experimenting with some audio files. I am loading them as follows:

    sound2 = new Sound(soundLoader);
    sound2.loadSound("sounds/beats2.mp3",true);
    sound2.onLoad = function(success:Boolean) {
         if (success) {
              // trace("loaded");
              sound2.start(0,999);
              //trace("looped");
         }
    };
    

    It works fine, only, its not in a loop. At first, I thought there is a problem with my code, and after a few follow-up, I discovered that the sound is not loop if it is isStreaming method property of . loadSound() set to true.

    If I do this:

    sound2 = new Sound(soundLoader);
    sound2.loadSound("sounds/beats2.mp3",false);
    sound2.onLoad = function(success:Boolean) {
         if (success) {
              // trace("loaded");
              sound2.start(0,999);
              //trace("looped");
         }
    };
    

    Then the sound loop everything as it should. But I prefer really to be buffered AND loop.

    Is it possible that I can do this? Am I missing something?

    Any help would be appreciated.

    Thank you very much!

    You can distribute and use the onSoundComplete method to restart your sound (without loops).

  • problem with loop module_data liquid with if statement

    I'm having a problem to the below statement inside the loop function for. I works very well outside the loop on a single post, but don't seem to take the entitlement when inside.

    {module_data resources = "blogposts' version ="v3"field model = 'PostFeaturedImage, release to id Date, postTitle, postBody,' =" "order =" "-id" limit = "5" skip = '3' = 'blogPosts' collection}

    {% for section in blogPosts.items%}

    {% If item.postFeaturedImage == "" %}}

    {% assign item.postFeaturedImage = ' / _assets/img/default_blog_picture.jpg '-%}

    {% endif %}

    < div class = "row" >

    < div class = "great-4 columns" >

    < p > < a href = "{{item.postUrl}}" title = "Read more" > < img src = "{{item.postFeaturedImage}}? Action = thumbnail & width = 1200 & height = 600 & algorithm = fill_proportional"alt ="{{item.postTitle}}"/ > < /a > < /p >

    < / div >

    < div class = "big-8 columns" >

    < h5 > < a href = "{{item.postUrl}}" title = "{{item.postTitle}}" > {{item.postTitle: capitalize}} < /a > < / h5 >

    < p > {{item.releaseDate | date: "dddd, MMMM yyyy"}} {{item.CAT}} < /p >

    < p > {{item.postBody | truncate: 220}} < /p >

    < a href = '{{item.postUrl}}' class 'more' = > read more < class i 'icon-angle-right' = > < / i > < / a >

    < / div >

    < / div >

    < hr >

    {% endfor %}

    Thanks in advance for any input.

    Not to assign the same name value.

    Assign a value with a new image name recommended before the, then this name within the FI, or just do an else if.

    {% If item.postFeaturedImage == ""-%}

    {% assign itemImage = ' / _assets/img/default_blog_picture.jpg '-%}

    {%-%}

    {assign = item.postFeaturedImage-% itemImage %}

    {endif %}

    {{itemImage}} to your image

  • Problem with button state

    Hello! I want to create a button with text. The State of the button should be the title of the text and the pointed State will be a paragraph with a rectangle in the background and the title disappears.

    I converted the title as button and I leave the paragraph text and draw the rectangle.

    My problem is when my mouse went hover title, nothing happened and when I went to move the paragraph box and rectangle, they seemed.

    Cannot choose the hover box? Can I create additional layers for rectangle and paragraph?

    The first time I try to create this button, he had run, but when I replace a bad shot.

    I'm working on the professional Flash CS6 and I use AS2. For example, I don't use THAT on my button, there is only 1 text converted to (title) button, 1 shape (rectangle) and 1 text (button).

    Fight with a button make me sick, if nursing Flash can cure my illness there will be great

    Good bye

    Tom

    If the invisible things in hover is the cause the invisible substance appears then looks that you have placed such things (text and background) under Hit of the button.  The image clicked sets where the button interaction can occur.   Make sure that you place only stationary flight controls in the frame over and no one else.

  • Problem with CASE statements

    Hi all

    I have a calculation in a report of Discoverer Desktop with 29 instructions BOX and still 2 case statements more to add. The problem is that my report freezes and fails to run due to the excessive number of case statements. I need to put the 31 statemnts cases in the report, how do I do this? Is there another way to do it without causing the report to freeze?

    Below is part of my instructions box just to show you what I'm doing:

    CASE WHEN Ex = 'MM' AND THEN of OTHER NULL result (', ')
    CASES WHERE Ex = "PP" AND result IN (40,35,30,25) THEN NULL OTHERWISE
    CASE WHEN Ex = he's ' AND result IN (' a ',' B', 'C', d ') THEN NULL OTHERWISE
    -CASE WHEN Ex = 'IO' AND THEN of OTHER NULL result ('Distinction', 'Merit')
    -CASE WHEN Ex IN ('ZZ', 'WW', 'SS', 'KK') AND ('PASS', 'P') THEN to ANOTHER NULL result...

    The last statement should be BOX WHEN... THEN NULL OTHERWISE 1 END END END END...

    Help, please. Thank you.

    Hello
    You have reached the limit of characters in a calculation.

    Try to set into a single statement as follows:

    CASE WHEN Ex = 'MM' AND THEN of OTHER NULL result (', ')
    WHEN Ex = "PP" AND as a result (40,35,30,25) THEN NULL OTHERWISE
    WHEN Ex = he's ' AND result IN (' a ',' B', 'C', d ') THEN NULL OTHERWISE
    WHEN Ex = 'IO' AND THEN of OTHER NULL result ('Distinction', 'Merit')
    WHEN Ex IN ('ZZ', 'WW', 'SS', 'KK') AND ('PASS', 'P') THEN to ANOTHER NULL result...

    The last statement should be BOX WHEN... THEN NULL OTHERWISE 1 END

    Another option is to combine all the statements of NULL in a series of gold options like this:

    BOX WHEN
    (Ex = 'MM' AND the result in (', am')) OR
    (Ex = "PP" AND result IN (40,35,30,25)) OR
    (Ex = he's ' AND translated BY (' a ',' B', 'C', ')) OR
    (Ex = 'IO' AND as a result ('Distinction', "according to merit")) OR
    (Ex IN ("ZZ", "WW", "SS", "KK") AND result IN ('PASS', 'P')) THEN ANOTHER NULL...

    Best wishes
    Michael

  • Problem with loop flv video

    Hello

    I'm just a few animation based on this video: http://www.YouTube.com/watch?v=JsPTAwsiKWc

    I have exactly the same animation as in this video, but when I'm doing a loop with the video flv file, it shows me this message:

    Scene 1, Layer 'Actions', image1, line 8 1119: access to property may be undefined COMPLETE through a reference with static type class.

    In the timeline one have only this code:

    Fl.video import. *;

    function videoPlay(event:VideoEvent):void {}

    Event.Target.Play ();

    }

    Left_video.addEventListener (VideoEvent.COMPLETE, videoPlay);

    It is exatcly same code as in the video but show me always error. I was several hours and each time I found the same code I used.

    I have Adobe Flash Professional CS5.5 and I use an AS3.

    Can you tell me someone what is the problem? Thank you.

    Hello

    You have this error because 'COMPLETE' isn't defind in the class 'VideoEvent '.

    Use constant to make it "complete."

    Fl.video import. *;

    function videoPlay(event:VideoEvent):void {}

    Event.Target.Play ();

    }

    Left_video.addEventListener ("complete", videoPlay);

  • Problem with the States and component in flex

    I am trying to build this flex like this application

    ExpertDiscoverySystem.mxml

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:Application ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" minWidth = minHeight = "1280" '960' xmlns:component = 'rate' currentState 'SearchStart' = >
    < s:layout >
    < s:BasicLayout / >
    < / s:layout >
    < s: states >
    < name s: State = "SearchName" / >
    < name s: State = "SearchDomain" / >
    < name s: State = 'SearchResult' / >
    < name s: State = "SearchStart" / >
    < / s: states >
    < fx:Declarations >
    <! - Place non-visual elements (e.g., services, items of value) here - >
    < / fx:Declarations >

    <!-< fx:Script >
    <! [CDATA]
    private void changeState (): void {}
    this.currentState = 'SearchResult ';
    searchpage.searchTerm.text = searchpage.getResult ();
    }
    []] >
    < / fx:Script >->

    "" < XY = '0' mx:Image = '0' source = '... / image/background.jpg "includeIn ="SearchDomain, SearchName, SearchStart"/ >
    <!-< s:TextInput '120,65' = x y = "507.8" width = "806" id = "searchText" includeIn = "SearchDomain, SearchName" / >
    < s:Button "951" = x y = '508' label = "Find it!" id = "Search" includeIn = 'SearchDomain SearchName'-click = "" / >-->
    < mx:LinkButton label = "Name" fontSize = "36" = "Verdana" includeIn = fontFamily click "SearchStart" = "currentState ="SearchName"" color = "#CE1717" enabled = "true" x = "383" y = "556" fontWeight = "bold" / >
    < mx:LinkButton fontSize = fontFamily "36" = "Verdana" click = "currentState ="SearchDomain"" includeIn = "SearchStart" color = "#CC1C1C" label = "Domain" '656' = x y = "555" fontWeight = "bold" / > "
    "< includeIn = 'SearchResult' x = '0' mx:Image = '0' source = '... /image/BackgroundSearch.jpg"/ >
    < s:TextInput = 'SearchResult' x = "542.1" includeIn = "47.6" width = "576" / >
    < s:Button = 'SearchResult' x = "1132" includeIn = '47.1' label = 'Search' id = 'Search2Button' / >
    < includeIn: search for components = "SearchDomain" x = "250" y = "420" >
    < / research components: >
    < component includeIn: searchResult = 'SearchResult' id 'Advanced' = x = "29" y = "115" >
    < / component: searchResult >
    < includeIn: search for components = "SearchName" x = "250" y = "420" >
    < / research components: >

    < / s:Application >

    and the component

    Search.MXML

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:Group ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" width = "800" height = "400" contentBackgroundAlpha = '0,0' xmlns:component = 'rate' >
    < s:layout >
    < s:BasicLayout / >
    < / s:layout >

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >
    < component id: searchResult = searchedTerm = "{"Advanced"searchTextInput.text}" >
    < / component: searchResult >
    < / fx:Declarations >
    < fx:Script >
    <! [CDATA]
    private void changeState (): void {}
    this.currentState = 'SearchResult ';
    searchpage.searchTerm.text = searchpage.getResult ();
    }
    []] >
    < / fx:Script >

    < s:TextInput width = "572" id = "searchTextInput" x = "49" y = "83" / >

    < s:Button label = 'find it!' id = 'search"click =" changeState () ""652"= x y ="84"/ >"
    < / s:Group >

    and searchResult.mxml

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:Group ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" width = "900" height = "800" >
    < fx:Declarations >
    <! - Place non-visual elements (e.g., services, items of value) here - >
    < / fx:Declarations >

    < fx:Script >
    <! [CDATA]
    [Bindable]
    public var searchedTerm:String;
    public var searchCriteria:String;
    public function getResult (): String
    {
    Return searchedTerm;
    }
    []] >
    < / fx:Script >
    < s:Label x = '6' y = '13' text = "" you searched: "fontSize ="18"/ >"
    < s:Label = "173" x = "13" fontSize = "18" id = "searchTerm" color = "#FF0000" / >

    < / s:Group >

    The problems goes like this. I need to access my main of my search.mxml component mxml application state 'SearchResult', with my code view, it is impossible to access at all because the State 'SearchResult' was not include the search.mxml component

    Is there anyway to access the State of my main application of my component?

    Hello

    Try to use FlexGlobals.topLevelApplication.currentState = 'SearchResult '; in your Search.mxml component.

    Thank you

    Jean Claude

  • problem with the States

    Hello

    in my application, I would like something code you see in the code.

    but this is not possible, because now I have two buttons with the id 1.
    What is the best way to solve this problem? especially when you have a lot of buttons? I mean, I need the id when I want to withdraw the child...

    Thank you!

    I think you need to rethink your statements. You try to add the same button in two States, which should not be necessary. You can base a State to another State, more specifically.

    Also, you cannot use numbers as identifiers.

  • Select problem with multiple statements

    I have a stored procedure where I create a table variable and then doing an insert and the problem I have is to separate my select statements that I use to insert into the table variable. I tried wrapping each select statement in parentheses and separating them by a comma; However, it does not either. I also tried aliasing the select statement with the same column name. I will be using the return on this stored procedure for a graph charting.

    Here's a SP and here is the error.


    The selection list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of columns in the INSERT.

    I try and rewrite in the form a single query using case statements. But the syntax that might work is

    insert into @SomeTable (col1, col2, col3)
    Select (select count (*) of @OtherTable).
    (select count (*) in @OtherTable),
    (select count (*) in @OtherTable)

    (> [TWO_RACES] [int] NULL)

    And it would be tall... everyone. LMAO

  • problem with client_host statement

    Hi all. I'm on devsuite 10g.
    I have a problem when executing client_host.
    With another application, I exported a job as a script (.bat file).
    Now, I want to run this file from my application form.
    With webutil I am able to locate the file on the client computer.
    To run it, I run this command:

    Client_host ("cmd /c start" | my_file_directory\my_file.bat |) '' );

    I encountered an error.
    So I created a .bat file, in which there is this command: calc.exe;
    Once I execute this file using the same statement in client_host, as before, I noticed that he has run from my office and in the back will appear this way:

    C:\Documents and Settings\dellipri\Desktop

    I tried to run my script working file both double click on it and manually open a back box and wrote the full path and name of the file and everything is OK.
    So what I would like to know if there is an option that I put in my statement of client_host in order to run the my_file_name from the path absolute and not from my office.
    Thank you all for collaboration,
    Fabrizio

    now, there's the * / d parameter mentioned above some messages:

    C:\Dokumente und Einstellungen\ChristianE>cmd /c "cd /d f:\test&&test.bat"
    
    F:\test>notepad test.txt
    
    F:\test>pause
    Drücken Sie eine beliebige Taste . . .
    
    C:\Dokumente und Einstellungen\ChristianE>
    

    concerning

  • Problem with loop "for".

    Hi all

    How can I solve this problem

    Disable indexing on the right side of the loop for.

    Consider using shift registers.

Maybe you are looking for

  • randomly

    Hi all I want to create size random 6 digit number, but it is very important that the number genetare will not be repeated I can this PREFORM in labview Thank you very much

  • Scan to computer HP4620 e-all in one

    I can't get my HP e-all in one 4620 to scan to my computer.  Message from CRO is not connected.  How can I fix it?

  • Wireless driver uninstalled itself, computer laptop cannot detect WIFI

    My wireless driver seems to have uninstalled itself. The blue WIFI LED indicator does not illuminate either. How to reinstall the driver without the disc? Someone's done it before, but I don't know how, and they are no longer available to help.

  • Apple LaserWriter v.23 printer & driver XP work in 32-bit Windows 7?

    I can't find ' Apple LaserWriter V.23 "Windows 7 32-bit printer driver.Although I use this before go Notepad of Windows XP with the default printer driver. Can give any help, if I need this with file port printer driver in Windows 7, 32-bit? Also, if

  • Problem report ASH

    Hi expert,I have the problem with the reports of ASH, when I run the script for report ash, I have the HTML that contains no data exists for each section of the report ASH.This part of ASH report:User Top eventsThere is no data for this section of th