How to make the query more efficient

Hi all

I use the following query in my app that works very well. Although I'm not an expert in PL/SQL, can someone please suggest how can I make the query more efficient? Because I use the same contract for every query table. Only difference is that in the name of the condition column. Again I am showing same column comments for each request. I was wondering if I can join these 3 and do 1 single request if possible

DECLARE
v_CONTRACTNO varchar2(100);
v_CHILDCONTRACTNO varchar2(100);
v_SOURCESYSTEM varchar2(100);

BEGIN
begin
SELECT comments
into v_CONTRACTNO
from user_col_comments
  where TABLE_NAME = 'CONTRACT'
and COLUMN_NAME = 'CONTRACTNO';
end;
begin
SELECT comments
into v_CHILDCONTRACTNO
from user_col_comments
  where TABLE_NAME = 'CONTRACT'
and COLUMN_NAME = 'CHILDCONTRACTNO';
end;
begin
SELECT comments
into v_SOURCESYSTEM
from user_col_comments
  where TABLE_NAME = 'CONTRACT'
and COLUMN_NAME = 'SOURCESYSTEM';
end;
END;

Thanks in advance...

Concerning

Nabila

Hi, Nabila,

The nabila Islam wrote:

Hi all

I use the following query in my app that works very well. Although I'm not an expert in PL/SQL, can someone please suggest how can I make the query more efficient? Because I use the same contract for every query table. Only difference is that in the name of the condition column. Again I am showing same column comments for each request. I was wondering if I can join these 3 and do 1 single request if possible

  1. DECLARE
  2. v_CONTRACTNO varchar2 (100);
  3. v_CHILDCONTRACTNO varchar2 (100);
  4. v_SOURCESYSTEM varchar2 (100);
  5. BEGIN
  6. Start
  7. SOME comments
  8. in v_CONTRACTNO
  9. of user_col_comments
  10. where TABLE_NAME = 'CONTRACT '.
  11. and COLUMN_NAME = 'CONTRACTNO ';
  12. end;
  13. Start
  14. SOME comments
  15. in v_CHILDCONTRACTNO
  16. of user_col_comments
  17. where TABLE_NAME = 'CONTRACT '.
  18. and COLUMN_NAME = 'CHILDCONTRACTNO ';
  19. end;
  20. Start
  21. SOME comments
  22. in v_SOURCESYSTEM
  23. of user_col_comments
  24. where TABLE_NAME = 'CONTRACT '.
  25. and COLUMN_NAME = 'SOURCESYSTEM ';
  26. end;
  27. END;

Thanks in advance...

Concerning

Nabila

Of course, you can get all 3 values in a query.  Here's one way:

SELECT contractno, childcontractno, sourcesystem

IN v_contractno, v_childcontractno, v_sourcesystem

Of user_col_comments

PIVOT (MIN (comments)

FOR column_name IN ('CONTRACTNO' AS contractno

'CHILDCONTRACTNO' AS childcontractno

'SOURCESYSTEM' AS sourcesystem

)

)

WHERE table_name = 'CONTRACT '.

;

But I doubt that it makes things very slow.   If your PL/SQL performance is poor, I suspect that the cause is somewhere that you haven't posted.

Tags: Database

Similar Questions

  • How to make the cursor more visible healing

    Hello

    I ask your help to find the answers to 2 issues related both to Adobe Lightroom and Photoshop.

    1. I use the remove task L R and Spot healing in Photoshop.  A few times I'm going to remove a stain, and the background makes the cursor so light that it would be difficult to see.  I wonder if I can darken or change the color of the slider so it would be visible.

    2. when I remove a task in Photoshop, I can go over the same area that I removed a task and do more remove or modify.  In the case R L I need cancel first healing I did and start a new one.  It's a little irritating and I wonder if I can do the same thing in L R.

    Thank you all for your help and your support.

    MB

    You cannot change the cursor in LR, but if you press A, the tasks will be displayed in black & white. Press A again to disable the visualization.

    Every place you heal in Lightroom is represented by two circles - a place where you click and one for the source. To change a spot, click on the place, then it becomes active, and you can change the size, or drag the circle to the source somewhere else. You can also change the size, feather and opacity in the spot light modify Panel.

    Spot healing in Photoshop is done by changing the pixels, while in LR, it's done with metadata.

    Large healing spot in LR will be, as you may have noticed, slow LR to a crawl, so if you have many tasks in an image, it is best done in PS.

  • How to make the query AS a parameter inside... ?

    Hello all :)

    I want to create the view object, where the query using oracle AS with the value of the parameter inside (variable binding), like this:

    SELECT WhLokasi.LOKASI_ID,
    WhLokasi.DESKRIPSI,
    WhLokasi.BARIS_KE,
    WhLokasi.KOLOM_KE,
    WhLokasi.SUBKOLOM_KE
    OF WH_LOKASI WhLokasi
    WHERE AS WhLokasi.DESKRIPSI * 'setting' * AND WhLokasi.BARIS_KE AS * 'parameter. "

    someone help me... Please... : d

    THX
    agungdmt

    Hi agungdmt,

    You have several options which are all explained in the developersguide.

    First use a bindvariable and encode the LIKE statement in the where clause of your viewObject (Dev Guide Chapter 5.10.1 how to add Variables to link to a definition of view object).
    It also shows an example

    select PERSON_ID, EMAIL, FIRST_NAME, LAST_NAME
    from PERSONS
    where (upper(FIRST_NAME) like upper(:TheName)||'%'
    or upper(LAST_NAME) like upper(:TheName)||'%')
    and PERSON_ID between :LowUserId and :HighUserId
    order by EMAIL
    

    Second option is to create and use named viewCriteria (5.11.1 how to create named view declaratively criteria).

    Third, and I think that this is not what you need at the present time, is to add where clause when executing (5.10.5 How to add a WHERE Clause with named Bind Variables when running)

    If I where you, I would choose the first or second option.

    Good luck

    Luc Bors

  • Box of text editing and how to make the files more small edge.js

    I have a project that contains 16 different text boxes. They are displayed or hidden depending on the button the user clicks. Everything works as expected, but look at the great edge.js file shows a LOT of redundant text formatting code. All the text boxes in exactly the same form, and each of them is a symbol.

    For example, the text box might look like this:

    First line

    Second line

    Third line

    Edge does not use anything other than a < p > or < div > don't tag for each line, i.e. no < ul > or < li > can be created directly on board.

    The corresponding part of the published edge.js file resulting looks like this:

    S104 = "< style p = \" margin: 0px; do-family: Arial, Helvetica, without serif. Police-weight: 400; make-style: normal; text-decoration: none; do-size: 12px; Color: rgb (0, 0, 0); background-color: rgba (0, 0, 0, 0); letter-spacing: 0px; text-transform: none; Word-spacing: 0px; text-align: start; text-indent: 0px; line-height: normal; ------"> first line < /p > < p = style-" margin: 0px; do-family: Arial, Helvetica, without serif. Police-weight: 400; make-style: normal; text-decoration: none; do-size: 12px; Color: rgb (0, 0, 0); background-color: rgba (0, 0, 0, 0); letter-spacing: 0px; text-transform: none; Word-spacing: 0px; text-align: start; text-indent: 0px; line-height: normal; ------"> second line < /p > < p = style-" margin: 0px; do-family: Arial, Helvetica, without serif. Police-weight: 400; make-style: normal; text-decoration: none; do-size: 12px; Color: rgb (0, 0, 0); background-color: rgba (0, 0, 0, 0); letter-spacing: 0px; text-transform: none; Word-spacing: 0px; text-align: start; text-indent: 0px; line-height: normal; ------"> third line < /p >"

    It's a LOT of unnecessary code. There must be a simple way to do it with CSS, like adding a class for each symbol - but this does not remove the inline style rules.

    You can that imagine how much space is consumed by these text boxes, many of which have more than 10 rows (< p > elements) each.

    Anyone know how to get around this problem?

    TIA!

    Even MORE interesting, is that I could take ALL this unnecessary inline using the waterfall style code for styling all those

    elements, simply by using a generic on their parent elements - works like a charm and the end result is that I cut the file size 88 KB to about 37 KB edge.js, while the associated HTML file went from 60 KB to 10 KB! I just took the pertinent information of ID and class of the HTML page. It seems a little counter-intuitive, but all this text style plain inline slowed the initial load to a significant degree. Be careful when you change something like that compressed, however.

    The generic switch I used was this:

    / * Text of the animation of edge

    only * /.

    div [id * = "_Text"] {p}

    do-family: Times New Roman, serif;

    font size: 1.1em;

    line-height:. 2;

    padding-left: .6em;

    }

  • How to make my code more efficient more readable

    As you can see I use event.target.selectedItem. (mydata) 4 times.
    I want to do something like this for the code readable and efficient.

    var myData:? = event.target.selectedItem;

    Philippe then able to get my 4 values to help
    myData.url;
    myData.name;

    How can I do?
    Thanks in advance

    I don't know a lot about the guts of flex, but I guess that it is based on the design of Java, etc.

    Storage event.target.selectedItem in an object should no longer be effective as calling event.target.selectedItem. The object will simply be a pointer of sorts of event.target.selectedItem. At no time in the call to event.target.selectedItem you doing a search, or something, in order to store the result will not result in big savings.

    Now, if you were doing something like array.findItem (something) 4 times, then Yes, it would be to your advantage to store data.

    Do not forget that event.target.selectedItem storage in an object will break no doubt... the links that may or may not be a problem. Object does not support binding. It is a subclass of the object that does, but I can't remember who.

    Just a suggestion based on my knowledge of how the data is stored in an object-oriented... language is perhaps not the case in flex.

  • How to make the query in a single query? No Union only please...

    Hello

    I have a series of about 18 queries that find charges in many scenarios. I wanted to have a single query to do this. which displays the result in a single line. Is it possible, I heard analytical functions are good options, but I am new to Oracle. Please help me.

    Select count (*) total_count emp; -100

    Select coun (*) MGR_count emp where job = "MGR" - 10

    Select count (*) dept_count emp where deptno in (10,20) - 75

    output...

    ----------

    TOTAL_COUNT MGR_COUNT DEPT_COUNT
    100                                   10             75

    Thank you

    Hello

    Here's one way:

    SELECT COUNT (*) TOTAL

    , COUNTY (CASE job WHEN = END "MGR", 1) AS mgr_count

    , COUNT (CASE WHEN deptno IN (10, 20) THEN 1 END) AS dept_count

    FROM table_x

    ;

    Instead of putting the conditions in a clause WHERE (where they would exclude whole lines), put the conditions in a CASE expression, where they affect only this column.

  • How to make the image more dark?

    I have a slide show, and I need to my darker images, he...

    You need to do this, use an image editing software.

  • How to make the menu letters more when you use Lightroom 4?

    How to make the menu letters more when you use Lightroom 4?

    Hey Lenovo W510,.

    The police of interface only option in Lightroom of sizing is in the preferences > Interface > panels > Font Size (Small/Large)

    The configuration in grand and then restarting Lightroom will increase the fonts you see in the signs that describe the functions of LR.

    If you're on Mac or Windows you might also decrease your screen/display resolution that will make everything look bigger on your screen.

    Hope this helps,

    Kind regards

    Pete

  • How to make the guides on a master page that is more effective

    I have a grid of guides on a master page. They do not appear in my pages to work, but they do not have this "magnetic quality" that I expect - things do not align with them. I have in my work pages and master page layers. Can someone help me sort out what I have to do to make the guides more effective? CS4 on Mac.

    "Align on the box" Options Guide 1px?

    In addition, 1 pixel is not much, maybe you don't see the snap. Try 5 pixels

  • How to make a program more former execution in windows 1.5 to enable my scanner HP scanner?

    I get an error message "incompatible application" when I try to scan on my HP Photosmart Plus B210 series.  I ran the troubleshooting and the supposed solution said to make older programs in this version (1.5) of Windows.  How to make a version more old execution?

    Hello

    Are you referring to Windows Azure 1.5 and if so you can post your question to:

    http://social.msdn.Microsoft.com/forums/en-us/windowsazuretroubleshooting/threads

  • How to make the updates of operating system for the limited user account?

    original title: how to make the updates of operating system for the limited user account?  Limited user account cannot access the Windows Update page, see instead cautioned against MS the most recent must be installed.

    XP Pro SP3 slipstreamed.  New a DBAN nuked HDD installation

    All the OS updates installed from Admin acct before creating the LUA

    AV installed AVAST

    all dot net uninstalled and then reinstalled to resolve a problem installing Quicken

    Updates to auto lit

    Active Windows Firewall

    Three solutions of workaround for Windows XP running as a limited user

    http://blogs.Computerworld.com/16502/three_workarounds_for_running_windows_xp_as_a_limited_user

    Survive a Windows XP Limited user account

    http://techknack.NET/surviving-a-Windows-XP-limited-user-account/

    See the response from Michael Kuntz - re: HAL files

    http://social.technet.Microsoft.com/forums/en-us/itproxpsp/thread/e8612ac4-b881-4FB3-85e7-32004932fb5f

    There is an available for installation of SP3 Cd

    Manually installing SP3 using the Microsoft Download Center or a CD

    If you have problems to receive the service pack from Windows Update, you can download SP3 as a standalone package from the Microsoft Download Center Web site, and then install SP3 manually. The installation package is intended for it professionals and developers, but you can always download and install this file.

    You can also order a CD from Microsoft containing SP3. For more information, go to the Microsoft site.

    To manually install SP3 using the standalone package installation or CD

    1. Do one of the following:

      • If you downloaded SP3 from the Web site, to install it immediately, click Open or run and follow the instructions on the screen. To install the program later, click on save and download the file to install it on your computer. When you are ready to install the service pack, double-click the file.

      • If you install SP3 from the Service Pack 3 CD, insert the disc into your computer with your current version of Windows XP running, and Software Update Installation Wizard should appear automatically. If this wizard does not appear, click Start, double-click my computer, click on your CD or DVD drive and then click AutoPlay.

    2. In Windows XP Service Pack 3 page, click Next.

    3. Follow the instructions that appear on your screen.

    4. Once the installation is complete, click Finish to restart your computer.

    5. If you disabled your antivirus software, turn it back on.

  • How to make the icons of programs appears on the screen of windows 8

    Hi Thunderlight, you helped me with my last request and thank you again now I have another question that you might be able to help me with.  How to make the icons of programs appears on my screen of windows 8?  I had to download the debut8 when I had windows 8 so I would have the appearance of windows 7 until I have to use Windows 8.  And some of my icons of windows 7 on my windows 8, but not all.  How to go on my windows screen 8 tiles?   I now get more usage of windows 8 and use it more now so would like all my original programs that I had with windows 7 on my windows 8 as it is now tile.  I thank you and hope you can help.

    Hi Laura,

    In theory, when you switch from an earlier version of Windows to Windows 8 - as your installed applications are kept by the upgrade process, except those who are not compatible - you should find all your apps in Windows 8.

    If they all do not appear on your start screen follow these steps to pin them there:

    • [Win] + C
    • Search
    • Click anywhere in the top middle of the screen to hide the charm bar

    All installed applications are displayed. They do not necessarily correspond on a single screen to use the horizontal "lift" to bottom of the screen to move to the right / left

    • Right-click on an application, you want to pin to the start screen
    • Click on Pin to Start at the bottom left of the screen

    You are finished. A mosaic of this application is available on the start screen.

    If there is an application, you are sure is installed on your PC and you don't think through the steps made me know - there will be more complex...

    If you install a new application under Windows 8 the corresponding tile is automatically added to your start screen.

    Hope this helps

    See you soon

    LZ.

  • How to make the same effect of scrolling like Tumblr (beginning Web page) with Adobe Muse?

    How to make the same effect of scrolling like Tumblr (beginning Web page) with Adobe Muse?

    I used Adobe Muse since the day it first came out, I played with the timings and effects of scrolling a lot. Tumblr landing page scrolling is very nice, I can see why you want a similar effect. Something similar could be created using the scrolling in AdobeMuse effects, especially if you familiarize yourself with the scrolling of the transparency. Start with a color block simple try it scroll up to double speed, then add items to the next page with the scrolling transparencies. Best practical work, use layers to do this, it makes things so much easier when you need to edit the page.

    Once you have played with the effects of scroll, you will begin to note how the elements of the Tumblr page can be re-created. This will be a sharp learning curve, but very doable in Muse for a similar effect. You will have a number of layers with page elements and new blocks of color on each layer when your done, fine tweaking the movement of scrolling and timings will make perfect. Good luck.

    If not, try adding an animation on board, you can create a Web page in Adobe Edge, but again... probably much more involved learning with this option.

  • How to make the progress bar display in the icon in the taskbar for WIN 7?

    How to make the progress bar display in the icon in the taskbar for WIN 7? I see Eclipse Helios can show the loading progress bar in the icon in the taskbar of WINDOWS 7 at startup.

    Is not the feature that provides JavaFX, you must write a native connection called technology such as JNI to make specific Windows API call for updating the icon in the taskbar for the application.

    Maybe you could go through the Eclipse source code to see how Eclipse and see if you can make use of the same mechanism in your application.

    More tips on how you can implement this are outside my area of expertise.

  • Does anyone know how to make the site in different languages?

    Does anyone know how to make the web in different languages? and how to make the menu appear on the master page in the target language?

    Hello

    You must create the page content in languages that you want and then bind using the options in the subfolder on root of the hosting platform.

    More details:

    http://forums.Adobe.com/message/6065652#6065652#6065652

    For the menu, you need to create different masters, and then apply on the pages.

    Thank you

    Sanjit

Maybe you are looking for

  • How can I get all emails to be saved on a different disk.

    I automatically save the data of all the programs I use on another drive for backup purposes.How can I do this with Thunderbird for current and future emails?A non-technical answer would be appreciated if possible.

  • Hexadecimal string of digital conversion

    I have the following string returned by a MODBUS instrument: My embedded data are 0104, 7530, 7530, 7530 that appears inside the Green brackets. I want to convert them into digital data relevant to 260, 30000, 30000 30000. Tried to do it with an atta

  • Laptop won't start

    I fell asleep last night with a running program and the laptop went to Hibernate.   I can't start up.   Unable to get anything else than a black screen.   Tried out of the battery and the power supply and restart, but which did not work.   I am runni

  • Rules and infrastructure register settings

    Probably a very stupid question: when it comes to the Infrastructue rules and registry settings, they are global, in other words, the INF_RunQueueLengthWarning would fire for a window Windows and Unix.

  • 7841 SIP Phone - Background Image

    Can I get a positive confirmation that the SIP 7841 landline does not support custom background images?  I've seen on google images that seem to show a 78xx research phone with a screen saver snoopy or similar image and this lead me to believe that t