Type of the object called several times Oracle constructor

I have an object of type with a custom constructor. In SQL, when I reference attributes the constructor is called several times in Oracle 11.2.0.4.

  1. Why the constructor is called more than once?
  2. How can I stop it?

My current job is about to reference attributes and use the / * + materialize * / tip.


Problem installation

    create or replace type Foo as object
    (
      Bar1 NUMBER,
      Bar2 NUMBER,
      Bar3 NUMBER,

      CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
        RETURN SELF AS RESULT
        DETERMINISTIC
    )
/
    create or replace type body Foo is

      -- Member procedures and functions
      CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
        RETURN SELF AS RESULT
        DETERMINISTIC
      AS
      BEGIN
        SELF.Bar1 := p_Bar1;
        SELF.Bar2 := p_Bar2;
        SELF.Bar3 := p_Bar3;
        dbms_output.put_line('Foo Constructor Called');
        RETURN;
      END;

    end;

Problem

    -- Constructor is called 6 times! 
    -- Once for each column and once for each predicate in the where clause.
    SELECT x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3, f
    FROM (
      SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
      FROM dual d
    ) x
    WHERE x.f.bar1 = x.f.bar1 AND x.f.bar2 = x.f.bar2

Output

Foo constructor called

Foo constructor called

Foo constructor called

Foo constructor called

Foo constructor called

Foo constructor called

Workaround

    -- Work Around
    -- Constructor is called 3 times
    -- Once for each column in the inline view. 
    -- Note, I removed column f (the object type) because it's not compatible with the materialize hint.
    WITH y AS (
      SELECT /*+ materialize */ x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3
      FROM (
        SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
        FROM dual d
      ) x
    )
    SELECT y.bar1, y.bar2, y.bar3
    FROM y
    WHERE y.bar1 = y.bar1 AND y.bar2 = y.bar2

Another solution is described in this thread... Access to the fields of an object custom type... which makes use of a type of collection combined with SCOREBOARD operator, like this...

create or replace type FooTable as table of Foo;

SELECT x.bar1 AS bar1, x.bar2 AS bar2, x.bar3 AS bar3, value(x) f
    FROM table(FooTable(
      foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3)
    )) x
    WHERE x.bar1 = x.bar1 AND x.bar2 = x.bar2
;

BAR1 BAR2 BAR2 F
1    2    3    (1, 2, 3)

Foo Constructor Called

Hope that helps...

Gerard

Tags: Database

Similar Questions

  • The purpose of programmatic view called several times ExecuteQueryForCollection

    [JDev/ADF v11.1.1.5.0]

    I am trying to create a VO that is not supported by DB, but instead takes its data from an external source (subsequently, a web service, but that's irrelevant to this question). I followed on each sample, I found and have created the VO and all overridden methods. I use this VO to create a LOV list for a VO another attribute, and the values in the LOV will vary based on a value in another attribute in the main volume (this is called LOVs cascading in various places).

    Here's an example, using the HR schema (a little artificial, I admit it):

    -Two your - DepartmentVO and ManagerVO - are defined

    -The DepartmentVO is supported by the DB and a normal EO and VO.

    -L' Manager in the DepartmentVO attribute is set to a supported by the ManagerVO LOV

    -The ManagerVO is programmatic and returns a list of employees who are in the same Department as the DepartmentID in the line of master DepartmentVO. To do this, use a Bind Variable (DeptId) that is set up to take the value of the DepartmentID attribute in the current line of DepartmentVO. This value of binding is used to filter the list of employees referred to only in the same Department.

    -J' replaced the executeQueryForCollection method in ManagerVOImpl. Here, I retrieve the value of the variable DeptId bind parameters passed in object/object2 to the method, and then use to retrieve employees in this Department of my main source.

    So far so good. Presents all works. (He lifts the employees in the same Department and displays them in the popup LOV.) If you change the Department then click to display the attribute Manager LOV, it shows you the list of employees in the new Department.)

    The problem I see is that the executeQueryForCollection method is called several times (2 or 3), causing the recovery of employees in the Department occur several times. For example, the test by running the AM executeQueryForCollection is called when I click the button to display the popup LOV (which makes sense). However, it is said AGAIN when I click the OK button in the popup LOV after selecting one of the values. (This should NOT!) And, if I create a JSF page and drop the data control to create a form and test it in this way, the executeQueryForCollection is called THREE times!

    I have the logic in the class ManagerVOImpl, which checks whether the list of employees has been recovered already, and if so, it's just returns the existing list. However, multiple calls are actually coming from different instances of the VO class, so that they only "see" the list has already been retrieved (because she was retrieved from another instance of the class, not this one).

    So my question is: How can I ADF do not call the executeQueryForCollection several times during the use of the VO as a LOV so that my (very expensive) call in the master repository to retrieve the list of employees is not executed more than necessary?  Is my only option to implement share caching mechanism myself that stores the list of employees of a Department somewhere in memory? I thought that ADF BC will make caching for me at the level VO?

    Thanks for any help that anyone can provide. I have literally been taken with that for two weeks, when I thought it would be a 'fast' to implement! :-)

    I'd be happy to upload/attach the source of my 'ManagerVOImpl' class, if that would be helpful.

    Have you tried to put a conditional statement in your back-end call happens only on your principal of the VO and not on the other 2 forums and see if that affects your functionality?

    that is, if (myIdName == "myVOInstance") {}

    do things;

    }

    I did it with VO this call that some heavy DB stored procedures in the executeQueryForCollection.

  • method of before the Phase of initMethod() in view calling several times:

    Hello world

    I dragged a table as read-only table with simple rank of verified selection.
    A button to go there in the page.
    The code in the go button takes the curretn by selecting the current row and the values of print.
    The initMethod() code is execution of the VO.

    The problem is when the page load the initMethod() (before the phase in view) calls several times even after loading the page.
    Continuously its call to this method.

    How to call only once when the page is loaded?

    All suggestions will be really useful.

    Thank you.

    Hello Kumar,
    There are many topics on the web to achieve this.
    This is one of them
    https://blogs.Oracle.com/ADF/entry/an_epic_question_how_to

  • call the owner VI several times

    Hi all

    I try to call the owner VI several times and was not sure if it's possible. I try to call the same VI in a VI with different condition.

    I have this VI as active with reentrant template (VI_1), and inside the loop, he calls another instance of this model (let's call it VI_2) and wait for the completion called VI (VI_2) and proceed to the next action. The problem, it's wait until done does not wait even if I set it to True. Can someone tell me what I am doing wrong? or even if this is possible.

    Thank you in advance.

    So the VI calls himself?

    If so, you can drop the VI to its own diagram if it is defined in the version of LabVIEW 2009 neres and later.

    Tone

  • How to extract the same song, several times using different bit rates or formats and store all the digital music files in WMP 12 default on the same HDD music library

    Using Windows Media Player 12 (w/under Windows 7), "can I ripping the same song, several times, using different bitrates & and/or formats and store all the digital music files in the music library by default WMP - 12, on the same hard drive?

    1.) #1 goal: tear up the same song repeatedly, w / "different rates" as a WMA file.

    2.) #2 goal: tear up the same song repeatedly, w / "different rates" as an mp3 file.

    3.) #3 objective: NOT to each subsequent copy (version) of the song, deleted & and/or replaced by the previous version of the song [even].

    4.) question Bottom Line Up Front--> is Windows Media Player 12 (included with the Windows 7 operating system) are able to achieve '#1 objectives; #2; & #3 above?

    5.) details/example: I want to tear the piece "Maria Maria by Carlos Santana" to my laptop as a Windows Media Audio [WMA] file.  In addition, I would like to rip the song 'Maria Maria' three several times with 3 different bitrates in format WMA; and, as an MP3 file.  Therefore, my final result wished (after the extraction process), will take place the four 4 audio files split up as follows: (a) 'Maria Maria by Carlos Santana'--> Format: file WMA; Ripped @128 Kbps bitrate.  (b) ' Maria Maria by Carlos Santana'--> Format: file WMA; Ripped to the "Variable bit rate; (c) ' Maria Maria by Carlos Santana'--> Format: file WMA; Ripped commissioning "Lossless." and (d). 'Maria Maria by Carlos Santana'--> Format: MP3 file. Ripped @256 Kbps bitrate.

    6.) my preference: I do NOT want to rename the file (s). {for example, 'Maria Maria by Carlos Santana' renamed/changed for--> "Maria_Maria_by_Carlos_Santana_128kbps.wma",...} 'Maria_Maria_by_Carlos_Santana_256kbps.mp3 '; etc.}.  In addition, I am not concerned about the additional disk space that will be consumed after multiple copies of the same song with different speeds of transmission and different formats.

    7.) my experience w / Windows Media Player 10 (w / the operating system of Windows XP): using WMP - 10, my goal (s) described above is not a problem at all.  Simply insert the CD purchased by Carlos Santana, containing the song "Maria Maria"... Select the desired Format (WMA; WMA VBR; WMA Lossless; or mp3)... Select the desired flow rate (WMA... 128/160/192kbps_mp3: 128/192/256/320 kbit / s; etc.) ; and click on the "RIP" button to start the copy process on the hard disk of of Carlos Santana's "Maria Maria".  This process (w / WMP-10) would result in having the same song, copied on the hard disk, with levels of quality different "audio" (via the different bit rate settings); regardless of the format (MP3/WMA) which was chosen.

    8.) my experience w / Windows Media Player 11 (w / the operating system of Windows XP): using WMP 11, to described above of my objective (s) could not be reached e-a-s-i-l-y.  The problem with WMP - 11 - in short - which was after the desired selection "Rip settings" tab 'Options' of WMP - 11 (i.e., Format & Bit Rate) and heart-wrenching piece wanted to {'Maria Maria by Carlos Santana'} a moment later/second, WMP11 remove / would crush the previous version of the song [even].  Therefore, the program would NOT allow the user to have multiple copies of the same song on the hard drive of the PC; which obviously restricts a user to have the freedom to choose what level of quality digital audio, they prefer to listen to.

    9.) the ability to have multiple copies [at my descretion] of the same song (on my hard drive) with different bitrates and formats in my music library, is important for me because it has a direct impact on "how I enjoy MY music ', and in what form (audio quality), I choose to listen to my music.  {For example, when I exercise and listening to my camera, digital audio player (Zune), a song ('Maria Maria by Carlos Santana'), will usually be torn off at a lower rate due to the unit of capacity reduction of storage - compared to the storage capacity of notebook PCs/desktop/external hard drives PC.}  However, when I listen to my music through my home cinema or entertainment system (which contains a hard disk dedicated with a large storage capacity), I prefer to load the entertainment system with digital music files that have been ripped to WMA... with the bit being rate-setting is for the: settings "WMA Variable Bit Rate" or "WMA Lossless.

    10.) there you have it.  This is my first post in this forum.  I hope that [detailed] explanations, will be sufficient to encourage these "with knowledge & the hands on experience" using Windows Media Player 12 (as well as with WMP-10/WMP-11 respectively), by providing a [step] "How-to"... "solution to my situation.  It would be highly appreciated.  I'm looking forward-'the solution' - and relevant suggestions & and/or community feedback regarding my request for assistance.

    * Thank 'All' (that would) in advance... For your time & Assistance *.

    Certainly, you can, but I would say that they be in different folders, for your convenience as well as Windows.  You can create one for each debit/format, then you will know who is who.

    In Windows Media Player, on the toolbar, select Tools, Options, Rip, and then select the flow you want first, rip music, then change the folder (higher on the same tab) and rip again... and so on and so forth.

    When you are at home on your home theater, you can use the 320 bitrate folder, when you transfer to the Zune, you can use one of the lower bitrate files (although I personally tear it up to 320 and let the Zune reduce as he wants, even with the iPhone via iTunes, hard drive space is not really a problem here) my server has several hard drives, and I can always add more if and when space is low!

  • FieldChangeListener fieldChanged called several times to EditField?

    Why fieldChanged is called several times in an EditField and how to avoid what is happening or maybe even control how many times the method, I want to be called, is called.

    The debugger that I noticed that my method is running serval times, most of the time + 20 times, and it's ruining the flow of just this is an edit field, is far from avoid this? I'm doing something wrong? or is this a normal behavior?

    I'm past the code if it helps, but if I can get the answers to these questions, am sure I can fix the code myself.

    Thank you

    Nevermind, figured it out, sorry for losing space, bandwidth, etc etc.

  • Even though I've updated to the latest version several times, I get messages from "update." How to stop the input messages?

    I get "upgrade to the latest version of Firefox" messages on my iMac, even if I downloaded the latest version several times. I'm afraid to click on the update message, because it might be spam/virus/whatever. Mozilla tells me that I downloaded the latest version of Firefox successfully. How to stop messages from appearing?

    Hello!

    Thank you to get in touch with us here at Mozilla's Support. I'll do my best to help you.

    To better help you with your question, please provide us with a screenshot. If you need help to create a screenshot, please see How to make a screenshot of my problem?

    Once you have done so, attach the file to screen shot saved to your post on the forum by clicking on the button Browse... under the box to post your reply . This will help us to visualize the problem.

    I see that you are running Firefox 25.0.1. Our latest version is the version of 26. But Firefox should display this update constantly. The screenshot is necessary so I can see if it's a legitimate link to Mozilla.

  • What happened to the button on the address bar which allow you to see the pages you had been so that you don't have to click the back button several times? I use it all the time and it is not on FF4.

    What happened to the button on the left end of the address bar which allow you to see the pages you had been so that you don't have to click the back button several times? You can look at the drop down window of pages and just choose whatever you want. I use it all the time and it is not on FF4. I want to go back to the old FF.

    If you right click on your back button, or click and hold down the mouse button, it will display the list. (I prefer a click-right, because sometimes my fingers slide when I try to click and hold)

  • Good day, notification of save my icloud does not close. I pressed the bottun close several times, but he's still on my screen. How this can be fixed.

    Good day, notification of save my icloud does not close. I pressed the bottun close several times, but he's still on my screen. How this can be fixed.

    Restart the device - without loss of data

    1. Restart your iPhone, iPad or iPod touch - Apple Support
  • 15 170tu ac: I HAV to press the power button several times to start the laptop...

    I HAV to press the power button several times to start the laptop... works well with the power supply on.

    all My drivers & bios is updated... but when I opened the lid... I HAV poer press several times the button and he then began 4-5 min.

    Hi @Vishalwagh123,

    Welcome to HP's Forums a great way to get help. It's a great place to find answers and advice! Thanks for the post.

    I understand you have questions turn on/off the device and you must press the power button several times for him to start. I'll be happy to help you.

    Please try these steps first. Perform a hard reset.

    • Steps to do:
    • Turn off the computer and unplug the charger. Then remove the battery.
    • Press and hold the power button on the unit for 15 seconds to carry out the static electrical charges inside the machine.
    • Replace the battery and the charger plug it back. Try to turn on the computer.

    If it fires up immediately the issue is resolved. Otherwise, try to turn on the computer without the battery and check that it works immediately.

    In your message, you said that it works very well with the charger. However, I need more clarity here to help you better.

    It works immediately when the adapter is connected and the power button is pushed only once?

    If you again press the power button several times, it may be a faulty power button, and you will need to contact the hotline at the service of the unit.

    Let me know what happens when you try to turn on the unit without the charger?

    Visit this link to contact support phone:

    http://HP.care/2bjG4nE

    Hope the problem is solved without hassle. Please keep me in the loop.

    Take care and have a week Holy.

  • I installed the printer coupon several times but every time I want to print, nothing happens.

    original title: Coupon printer

    I installed the printer coupon several times but every time I want to print, nothing happens.  I followed all the instructions, but when the coupons are supposed to be sent to my printer that they do not print.  What can I do?

    Hello

    If you have problems with the software or hardware contact their manufacturer for appropriate assistance

  • My laptop is down the internet connection several times daily.

    Internet connection

    My laptop is down the internet connection several times daily. I can usually restore the connection to solve the problem. It restores the connection for a while but always says the same thing. «A network cable connected correctly isnot or can be broken and also problem with wireless adapter access point.» I live with 3 other people and we all use the same router and they have no problems.

    Also, my computer has some weird pink points at the top of the home screen. So sometimes when I pull up to early or a photo or something there are pink lines on the photos. No idea why this is happening and how to fix it?

    I discovered that I had the same problem of the abandonment of the Internet with HP envy. I went on the Intel site and found that they had a fix for the problem I do not know the wireless card you have that I go to your site of NIC and check and see if they have a patch for your network card. After I installed the patch for my NIC my problem disappeared. HP sent me an email with the appropriate also fix.

  • I have a problem with IBM Lotus Symphony - the program crashing several times every 5 seconds

    Original thread - I have a problem with IBM Lotus Symphony.  I am trying to edit a document, and I can't get any task done without the program crashing several times every 5 seconds.  What can I do to fix this?

    The program crashes every 5 seconds.  I started having this problem last night, but I didn't even know that first of all, there was a problem until today.

    Hello
     

    You receive an error message/code when you edit a document in IBM Lotus Symphony?
     

    I suggest to put the computer in a clean boot state and then try to open the program and check if it helps.
    Note: when you perform a clean boot, you may temporarily lose some functionality. When you start the computer as usual, the function returns. However, you may receive the error message, or you can experience the original behavior.
    How to solve the problem by running the clean boot in Windows 7:
    http://support.Microsoft.com/kb/929135
    Note: once you have completed troubleshooting, perform the steps in the step 7: to reset the computer as usual.
    If the problem persists please contact the IBM Lotus Symphony support for assistance. See the link below.
    http://www-03.IBM.com/software/Lotus/Symphony/ForumnsHome.nsf/home
     
    It will be useful.
  • Can I fade in and out on the same track several times in After Effects?

    Hi all

    I was wondering if it is possible to fade in and out, on the same track, several times. Like, I have this audio I want to fade at the beginning-48db to + 0 dB, and at the end of the song I want it to go from + 0 dB to-48db. I don't know if it's possible, but I can't get it to work. Can I get more than two keyframes for the same way?

    Thank you for taking the time to read my question.

    Marco van Lindt

    I do not recommend the use of AE to do any sort of audio work, but yes. You can have hundreds of keyframes by track. If you set the value, we must add another keyframe. There is no that?

  • Help please - component video using the same clip several times

    Hi people,

    I have a 9 minute video I want to cut into pieces and make a 3 min video. I searched the help system and Forum, but found nothing - very probably (not being is not a native speaker) looking for the wrong keywords.

    How can I add the same clip several times to a movie? If that has been resolved, I could do the rest with setting- and outpoints and would.

    Thank you in advance.

    Christoph

    You can place the clip on the timeline and use the Split Clip (small scissors under the monitor icon) to split your clip. Place the cursor where you want to trim your clip, and then click the icon of the scissors. Move the cursor to the next position, and then click the icon of the scissors again. Then press DELETE on your keyboard and that article will be deleted and the gap will be closed. If you wish, you can take small sections, you created and drag them around to change their positions.

    Once you have edited your clip, you can export the section 3 minutes as a DV - AVI to use repeatedly in your video. All you need to do to export is file > export > Movie. If you have several clips on your timeline you must place the work area bar (WAB), the gray bar above the timeline, on the section that you want to export. Then in the window export movie go into settings and for the beach, select work area bar.

    You can then reimport the 3 minute clip in your project and use it as many times as you want.

Maybe you are looking for

  • Change in the ID of arbitration with the help of usb-8473

    Hello everyone, IAM using USB 8473 Receive messages on CAN Bus. For what Iam using CAN Receive.vi and Net Interface Logging.vi. IAM receiving messages correctly, but I have a problem in arbitration received IDS. If the current arbitration ID is 0 x 1

  • ways to increase the performance of the processor

    It might be a silly thing to ask, but I can use a 4 GB USB key to increase the performance of the processor during execution of the movies netflix and Amazon to steam. I have 17.4 GB of free space, but then the streaming of the CPU usage is maxed out

  • Can Windows Photo Gallery - I remove profiles of scanning?

    I use Windows Photo Gallery > import from a Scanner or a camera to scan documents. I've created a few different profiles in the scan dialog box, but I want to get rid of some of them.  Someone knows how to do this?  I tried right clicking, pressing D

  • X 360 spectrum: Spectrum X 360: how optimize or prolong the battery

    That battery is built in camera... which cannot be separated/detached, No recommendation for heavy users use every day at least 10 hours. Occasionally 2-4 hours in portable mode.

  • Download the update for other Microsoft products

    When you try to change the settings, I get the following URL address: http://www.update.microsoft.com/windowsupdate/v6/thanks.aspx?ln=en&&thankspage=5 I checked the other options, and they are as it should. Is this a redirect? I know that hackers use