PL/SQL many subqueries with a result

I have the following query that uses three tables. The first two are no problem, but the last has three subqueries. Each subquery creates its own column of result, but I want all three merged in the result column.

Three subqueries are looking to different areas that contain 250 indicators each. In order to adapt to all the data from the indicator, it was divided into three groups.

Now, each quest research the 250 columns in each area and produced a column of data. But I really need a column with the data from all three subqueries.

Query:

Select CSS_TBL_CD , cast(substr(CSS_TBL_ADD_DESC,1,4) as int) as trans_index,

(select trmenukey )

       from law . tbltransaction

where trmenukey = css_tbl_cd() like in_select

(select (substr (SECRTY_LAYOUT_001_250, (substr (,CSS_TBL_ADD_DESC,,,1,,4)),1)) )

       from LAW . Z_CSS_USER_SECRTY_139_A

       where secrty_level = '9 '

and secrty_level_desc > '0'

       and (substr(CSS_TBL_ADD_DESC,1,4)) < 251) as zsec,

(select (substr (SECRTY_LAYOUT_251_500, (substr (,CSS_TBL_ADD_DESC,,,1,,4)) - 250,1)) )

       from LAW . Z_CSS_USER_SECRTY_139_A

       where secrty_level = '9 '

and secrty_level_desc > '0'

       and (substr(CSS_TBL_ADD_DESC,1,4) > 250)

       and (substr(CSS_TBL_ADD_DESC,1,4)) < 501) as zsec,

(select (substr (SECRTY_LAYOUT_501_750, (substr (,CSS_TBL_ADD_DESC,,,1,,4)) - 500,1)) )

       from LAW . Z_CSS_USER_SECRTY_139_A

       where secrty_level = '9 '

and secrty_level_desc > '0'

       and (substr(CSS_TBL_ADD_DESC,1,4) > 500)

       and (substr(CSS_TBL_ADD_DESC,1,4)) < 751) as zsec

F rom law. css_tbl

CSS_TBL_NO = '1055'

Et substr(CSS_TBL_ADD_DESC,1,4) > '0'

Order by CSS_TBL_CD;


Result:


Thursday, February 20, 2014 14:21

CSS_TBL_CD

TRANS_INDEX

IN_SELECT

ZSEC

ZSEC_1

ZSEC_2

CGSCRN

529

CHGADR

360

CHGADR

THERE

CHGLES

1 220

CHGNAD

30

CHGNAM

694

CHGNAM

THERE

CHGSET

113

THERE

CICARD

101

CICARD

CLNADD

255

CLNADD

THERE

CLNCHG

256

CLNDEL

257

CLNEVT

259

CLNINQ

258

CLNINQ

THERE

CLOCUS

356

CLROSF

502


I need to have three columns ZSEC merged into a single result.

Indicators of outcome would never be more than one column (for example ZSEC there would never be ZSEC2)


Any help would be greatly appreciated

just judging by the boss, I see three queries inline as

Select case when to_number (substr (CSS_TBL_ADD_DESC, 1, 4))<>

then (substr (SECRTY_LAYOUT_001_250, (substr (CSS_TBL_ADD_DESC, 1, 4)), 1))

When to_number (substr (CSS_TBL_ADD_DESC, 1, 4)) between 251 and 500

then (substr (SECRTY_LAYOUT_251_500, (substr (CSS_TBL_ADD_DESC, 1, 4)) - 250,1))

When to_number (substr (CSS_TBL_ADD_DESC, 1, 4)) between 501 and 750

then (substr (SECRTY_LAYOUT_501_750, (substr (CSS_TBL_ADD_DESC, 1, 4)) - 500,1))

end zsec

of the ACT. Z_CSS_USER_SECRTY_139_A

where secrty_level = '9'

and secrty_level_desc > '0'

Concerning

Etbin

Tags: Database

Similar Questions

  • anonymous block of pl/sql procedure ended with no result

    started just learning oracle pl/sql and I am facing a problem here.

    I have no problem to compile, but whenever I run the nth procedure would seem except the following message is displayed and not showing any output that should not be the case: block anonymous filled

    I tried to set serveroutput size 50000; changes but nth.

    Here is my pl/sql procedure not sure if I'm doing things.

    CREATE OR REPLACE PROCEDURE CHECK AS

    empnum NUMBER;

    EmpName VARCHAR2 (50);

    BEGIN

    Select employee.e #.

    , Employee.Name since it is

    in empnum

    empname

    Join driver used on driver.e # employee.e = #.

    Mechanic to join on mechanic.e # driver.e = #;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    DBMS_OUTPUT. Put_line ('ok');

    END CHECK;

    /

    I'm trying to achieve the same result in the following sql query:

    select employee.name, employee.e#
    from employee join driver
    on driver.e# = employee.e#
    join mechanic
    on mechanic.e# = driver.e#
    where rownum = 1;


    If there is no similar records if it will display the employee name and numbers. If there is no such document found it will show an ok message.

    My bad, NO_DATA_FOUND is not triggered when a select statement is used like that. This is a way to approach it.

    create or replace procedure check
    as
    number of empnum;
    EmpName varchar2 (50);
    is_exist boolean;
    Start
    I'm in)
    Select employee.e #.
    , Employee.Name since it is
    Join driver used on driver.e # employee.e = #.
    Mechanic to join on mechanic.e # driver.e = #.
    )
    loop
    is_exist: = true;
    dbms_output.put_line (' e #-' | lpad (IE #, 20, ' ') |) ' name ' - | i.Name);
    end loop;

    If not is_exist then
    raise the no_data_found;
    end if;

    exception
    When no_data_found then
    dbms_output.put_line ('ok');
    end check;
    /

    This isn't a very elegant way of doing things. But I am limited to knowledge of the requirement of the company. Therefore, the best I could come up with. If you can explain how you're going to put this procedure into your business situation we could help you better.

  • Too many problems with the latest version of Lightroom

    Hi all

    I have too many problems with the latest version of Lightroom (CC 2015.2.1 1046594)

    In fact, the latest version of 3 or 4 were bad: instead of doing better, I always had more problems.

    So I would like to go back to a previous version of lightroom

    Adobe customar care, in Italy, is unnecessary:

    they can just to:

    -looking for answer on this forum

    -saying "you solve your problems just with the de-insall and re-install it.

    stop, no more...

    in this way they create me a lot fo iusses...

    I use the English version of the PS and LR, but they made me reinstall the Italian version of CC because it has been blocked

    the result was that CC does not recognize software, due to a different language version

    so, I contacted again Adobe Customer Care... they said "no problem, uninstall LR, delete these files and install this...

    I did and I let go 2 years to develop the parameters on the correction of the colors for my clients because they told me to remove a folder, I need!

    so, I ask you now if there is a way to return to a previous version of lightroom, any previous version...

    I never found better performance in more recent versions...

    I've always found, performance slower, more problems...

    personal idea: I do not understand why adobe are boicotting itself, but I think he do!

    Thanks to you all

    Hi ramontillo,

    6.3/CC 2015.3 Lightroom is now available - try to update to this version which includes the previous import feature, bug fixes and new support for photo/target device profile: Lightroom CC 2015.3 / 6.3 now available

    Concerning

    Pete

  • Fill a table with the results of the refresh groups

    Hello world

    I need a little help.

    I'm working on an Oracle 10.2.0.4 on windows.

    I have a table I created like this:
    Table name: DIM_REPLICA

    COD_SEZ VCHAR2 (2)
    NOME_SEZ VCHAR2 (20)
    FLAG TANK (1)
    DATE OF D_REPLICA

    This DB I have 210 discount groups running every night. I need fill this table with the results of the refresh groups.

    So when the refresh for example called ROME group runs I need to write on the table the name ROME in the field "NOME_SEZ", a Y or N if the refresh Group has worked in the field of the INDICATOR and LAST_DATE refresh force ran into the field of the D_REPLICA. The COD_SEZ field is a code that I get other things. It is not necessary for the moment. I can add it myself on my own.

    Can someone help me please?

    I was looking on the tables SYS DBA_JOBS and DBA_REFRESH these data, but I don't know what to take and how to fill the table. Trigger? Procedure? Any help will be great!

    Thank you all in advance!

    This forum is for SQL * PLus, questions and your question is about general issues Oracle. You will get a better response by posting your question in another forum - probably the General database instance.

    Please close this thread and start over in another forum.

  • Huawei P9 - I have many issues with getting my pictures from the phone to my Imac

    Huawei P9 - I have many issues with getting my pictures from the phone to iphoto on my Mac.

    Before the summer I bought a Huawei P9 phone, I can easily see the photos on the phone - I can't just them on my mac.  When I connect via a USB cable, it refuses my permissions.

    I try to use my Google account to view on the Mac and move the iPhoto - I can't work either! I can see them, I can't move them!

    I'm pulling my hair out and I have enough to do with! Help, please...

    Jim Hosking

    You need the phone provider support - there is a problem with the way their phone works and how to use it and has nothing to do with the Photos or iPhoto - if pictures is consistent with standards of good Photos and iPhoto won't work with it

    You may need special third party software for your phone load in Photos or iPhoto

    LN

  • When I search something, firefox opens a new tab with the results. How can I change the settings to where it will stay all in the same tab?

    When I search something Firefox automatically opens a new tab with the results of this research. How can I change the settings to where the results will appear in the same tab where I made the research?

    If you want to open search results in a new window most often is a parameter of the search engine you use.

  • I'm unable to access my Hotmail account. He told me I've tried too many times with an incorrect password. After resetting the password it still doesn't let me.

    I can't access my hotmail as it suggests I tried too many times with an incorrect password. I have reset the password by the presence of a link sent to another and also have an sms on my mobile phone code. Nothing works!

    original title: I can't access my hotmail account

    CarpeDiem44,

    Please join the Windows Live experts in the Windows Live Solution Center community to try to regain access to your Hotmail account. The link below will take you directly to their forum for security account.
    Windows Live Solution Center - Windows Live ID.

  • I have no sound on my computer (Windows XP). I installed audio driver with no result. What to do next?

    No sound

    I have no sound on my computer (Windows XP). I installed audio driver with no result. What to do next?

    Hi f. Mac,.

    Follow the steps in the article.

    How to troubleshoot sound problems in Windows XP

    No sound in Windows

  • FSX MULTIPLAYER DOES NOT HAVE MANY PEOPLE WITH THE SAME PROBLEM

    I have a FSX I've always used the multiplayer mode for online flight, now a few weeks ago its been not conect, my internet is good, everything works but is not multiplayer, many people with this problem, tell us how to find a solution, we really like this multiplayer game

    Hello

    Thanks for posting your query in Microsoft Communities.

    According to the description of the problem, it seems that you are not able to play Flight Simulator X multiplayer.

    Please go ahead and read the steps mentioned from the link and later a update on the State of the question.

    Microsoft Games: Multiplayer troubleshoot

    You can also stay in contact with the Flight Simulator with the help of the link and check if it helps.

    http://www.Microsoft.com/products/games/FSInsider/tips/pages/default.aspx

    I hope this helps. Let us know if you need more assistance.

  • I can't connect to my e-mail account. I tried too many times with the wrong password and when I try to reset the account that it won't let me.

    I can't connect to my email. someone tried too many times with an incorrect password. When I try to reset my email it doesn't let me, someones tried too many times also. I know that my question of password and security. What can I do?

    original title: unable to connect to my email.

    Hello

    Answers is a peer group supported and unfortunately has no real influence on Hotmail.

    HotMail has its own Forums, so you can ask your questions there.

    Windows Live Solution Center - HotMail - HotMail Forums Solutions
    http://windowslivehelp.com/

    Hotmail - Forums
    http://windowslivehelp.com/forums.aspx?ProductID=1

    Hotmail - Solutions
    http://windowslivehelp.com/solutions.aspx?ProductID=1

    How to contact Windows Live Hotmail Support
    http://email.about.com/od/hotmailtips/Qt/et_hotmail_supp.htm

    Windows Live Hotmail Top issues and Support information
    http://support.Microsoft.com/kb/316659/en-us

    Compromised account - access unauthorized account - how to recover your account
    http://windowslivehelp.com/solution.aspx?SolutionID=6ea0c7b3-1473-4176-b03f-145b951dcb41

    Hotmail hacked? Take these steps
    http://blogs.msdn.com/b/securitytipstalk/archive/2010/07/07/Hotmail-hacked-take-these-steps.aspx

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • I keep trying to find ways to update all my drivers at a time, as many problems with this computer

    ORIGINAL TITLE: update drivers, fixing problems, etc. NOTHING WORKS.

    I keep trying to find ways to update all my drivers at a time. There are so many problems with this computer, I'm so frustrated and things on it, I have to PAY TO ASK a QUESTION FOR CUSTOMER SUPPORT. Seriously, I'll blow my head because this trash is so UN-easy to use.

    Is - it really too much to ask for a single ' difficulty my * ing of the computer problems "button?

    Here is a list of what specifically is messed up. I don't want to spe backspace to show what I mean.

    I type really fast and never skip a key. Howeer, the computer ignores the keys as in the words "SPE" and "howeer" I typed jut. Now it's "jut" instead of "right".

    So, there is a problem that should not be happenng.

    Secondly, I play some games including the [scroll] scrolling bar on the frame-inmousepad does not work, period. 2011-2012 release, so it's something I can't fix on mymouse of course. I tried fixing it, and he says he successfully fixed wa. LOL no, it wasn't, it's just * ed even more.

    I refuse to poor a ton money int. f fixing these problems because I simply don't trust they're going to fix anything, and these problems should not occur initially.

    k so bye, go go rifle my brain of becaue it's so rustrating.

    Hello
     

    1. does come with any specific application?

    2. who is the manufacturer of the computer?

    3 did you changes to the computer?

    Keyboard problem:
    Method 1: Try with the keyboard on the screen and see if it helps.
    Method 2:
    Check if the problem persists in safe mode with network, to start the computer in safe mode, follow the below mentioned article:

    Link, please refer to: start your computer in safe mode:
  • Windows Update search updates with no results or returns the 8007000e error code. Windows Update Troubleshooter tried unsuccessfully

    Just installed Win7 Sp1 on Inspiron 1525 after you mount the new HARD drive. Works very well. However, Windows Update search updates with no results or returns the 8007000e error code. Tried troubleshooting of Windows Update without success. Indeed, I am unable to update Windows.

    Please run the Windows Update Troubleshooter:
    http://go.Microsoft.com/?linkid=9830262

    Please provide the exact details of any problem it reports as not fixed.

  • Many problems with Windows, Windows cannot communicate with the device or resource (primary DNS server)

    Many problems with Windows, Windows cannot communicate with the device or resource (primary DNS server), Internet Explorer browser does not.

    Hi Rachel,

    I understand that when you try to connect to the Internet, you get error "Windows cannot communicate with the device or resource (primary DNS server)", what other issues you are faced with Windows?

    • Using a cable or a wireless Internet connection?

    DNS (Domain Name System) translates the URL in IP (Internet Protocol) addresses (and vice versa). For example, if you type http://www.microsoft.com into the address bar in your web browser, your computer sends a request to a DNS server. The DNS server translates the URL to an IP address so that your computer can find the Microsoft web server.

    I suggest you to follow the methods in this article and check if it helps.
    http://support.Microsoft.com/kb/2779064/en-us

    Let us know if it helps.  If the problem persists, please answer, we will be happy to help you.

  • Whenever the opening of Windows Live Mail, receiving the message: "your account has been locked because you ar anyone else tried to sign in too many times with incorrect e-mail address or password."

    Original title: problem of signature in emails.

    Everytime I open my Windows Live mail I get the message "your account has been locked because you ar anyone else tried to sign in too many times with incorrect e-mail address or password."    After a few seconds, I can click on cancel and my posts are appear in the preview window.  How can I stop this from happening?

    Hi Annabelle.

    What account you have set up in Windows Live Mail?

    You can first try to connect directly to the webmail to address account email configured in a browser and check what is happening.

    If you receive the same error, then you must contact the support for the e-mail service provider.

    If you use a Microsoft Account, you can post your query in the section has Microsoft Windows Live Forums to get help.

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

  • Working with the results of the Action generated Poweshell

    Hello

    I have an action from orchestrator of a powershell script/function that I use regularly. The function is supposed to return a System.Object with email content (n, fromAdd, body, etc) that I would use in a script task.

    The problem I'm having is that I can't access these results in my work of scriptable. I know that the performance of the action a PowerShellRemotePSObject (and I have reviewed the literature on 'Working with PowerShell results'), but none of my attempts to explore the values give the results, I'm looking for. I'd appreciate any help to know what I'm missing.

    Thank you

    Thank you once again Ivo. Sorry for the delayed reactions. I took a peek at the solution you provided but had a few mistakes - there was no GetFilter() function defined for the call to psObject.getRootObject () .getProperty ('from'). After fiddling around with the results, I found my solution.

    I basically closed the rootobject of the return value of invocation of script that turns out to be a collection data structure (last result in the enumeration in italics/bold).

    .....

    rootObject var = psObject.getRootObject

    (rootObject element)

    {

    System.log (rootObject [index])

    }

    [10:43:33.159 2013-12-10] [I] DynamicWrapper (Instance): [PowerShellPSObject]-[class com.vmware.o11n.plugin.powershell.model.result.PSObject] - VALUE: com.vmware.o11n.plugin.powershell.model.result.PSObject@e9e592

    ....

    It turns out that the value of back in my Powershell script is the last element in the collection. from there, I could get my values:

    System.log (rootObj [rootObj.length - 1] .getProperty ("to"));

    System.log (rootObj [rootObj.length - 1] .getProperty ("from"));

    System.log (rootObj [rootObj.length - 1] .getProperty ("Subject"));

    System.log (rootObj [rootObj.length - 1] .getProperty ("body"));

    System.log (rootObj [rootObj.length - 1] .getProperty ("logFile"));

    I don't know if this will always be the case with psObject return values of Powershell called scripts, but several tests will help.

    Thanks for your time.

Maybe you are looking for