Select as column

hi,
i got problem with this statement
select q.a, q.b, q.c, (select s.d from table s)
from table q
it is possible to use select as column within another select?
because this fails with error 103..
thanks

select /*+xrule*/omh.CODE_OMH,omh.DESCRIPTION, seg.CODE_SEG, segp.CODE_SEG CODE_SEG_P,
select sum(tri.AMOUNT)
from
dw_cons.sdi_dimension sdi,
dw_cons.ana_dimension ana,
dw_cons.sdi_dimension sdip,
dw_cons.org_dimension orgp,
dw_cons.org_dimension org,
dw_cons.TRIAL_BALANCE tri
where tri.code_org = org.CODE_ORG
and org.CODE_SDI= sdi.CODE_SDI
and tri.code_org_p = orgp.CODE_ORG
and orgp.CODE_SDI = sdip.CODE_SDI
and tri.code_ana = ana.CODE_ANA
and ana.CODE_OMH = omh.CODE_OMH
and ana.CODE_OMH = omh.CODE_OMH
and tri.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdi.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdip.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdip.CODE_SDG = '001039' ----!!!! PARTNER -> SDG ( spolocnost)
and cin.CODE_SDG=sdi.CODE_SDG
and sdip.CODE_SEG=segp.CODE_SEG
and sdi.CODE_SEG=seg.CODE_SEG
and tri.ROW_SOURCE = 'S'
) amount_net,
(select sum(tri.AMOUNT)
from
dw_cons.sdi_dimension sdi,
dw_cons.ana_dimension ana,
dw_cons.sdi_dimension sdip,
dw_cons.org_dimension orgp,
dw_cons.org_dimension org,
dw_cons.TRIAL_BALANCE tri
where tri.code_org = org.CODE_ORG
and org.CODE_SDI= sdi.CODE_SDI
and tri.code_org_p = orgp.CODE_ORG
and orgp.CODE_SDI = sdip.CODE_SDI
and tri.code_ana = ana.CODE_ANA
and ana.CODE_OMH = omh.CODE_OMH
and ana.CODE_OMH = omh.CODE_OMH
and tri.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdi.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdip.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdip.CODE_SDI = '?'
and cin.CODE_SDG=sdi.CODE_SDG
and sdi.CODE_SEG=seg.CODE_SEG
and tri.ROW_SOURCE IN ('S','A')
) no_part,
select sum(tri.AMOUNT)
from
dw_cons.sdi_dimension sdi,
dw_cons.ana_dimension ana,
dw_cons.sdi_dimension sdip,
dw_cons.org_dimension orgp,
dw_cons.org_dimension org,
dw_cons.TRIAL_BALANCE tri
where tri.code_org = org.CODE_ORG
and org.CODE_SDI= sdi.CODE_SDI
and tri.code_org_p = orgp.CODE_ORG
and orgp.CODE_SDI = sdip.CODE_SDI
and tri.code_ana = ana.CODE_ANA
and ana.CODE_OMH = omh.CODE_OMH
and ana.CODE_OMH = omh.CODE_OMH
and tri.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and sdip.CODE_SDG = '001039' ----!!!! PARTNER -> SDG ( spolocnost)
and cin.CODE_SDG=sdi.CODE_SDG
and sdip.CODE_SEG=segp.CODE_SEG
and sdi.CODE_SEG=seg.CODE_SEG
and tri.ROW_SOURCE='A'
) amount_adj
from dw_cons.seg_dimension seg,
dw_cons.seg_dimension segp,
dw_cons.OMH_DIMENSION omh,
dw_cons.sdg_dimension sdg,
dw_cons.elim_type elt,
dw_CONS.CONSOLIDATION_INTERSECT CIN
where sdg.CODE_SDG = '006041' ----!!!! SDG ( spolocnost)
and cin.CODE_SDG=sdg.CODE_SDG
and cin.CODE_ELT = elt.CODE_ELT
and elt.CODE_OHH_LEFT = omh.CODE_OHH
and seg.CODE_SEG<>'?' and segp.CODE_SEG<>'?'
and omh.CODE_CPE= 'A200703' ----!!!! Aktualna perioda
and elt.CODE_CPE= 'A200703' ----!!!! Aktualna perioda
and sdg.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and cin.CODE_CPE = 'A200703' ----!!!! Aktualna perioda
and elt.CODE_ELT= 'MAJETOK' ----!!!! ELIMINATION_TYPE
and seg.CODE_SEG IN('C','D','L','R','P')
and segp.CODE_SEG IN('C','D','L','R','P')

Similar Messages

  • How to select all columns in a trigger?

    I add a "before delete" trigger on a table, in order to insert the records to a backup table before they are deleted.
    but I cannot write like this : insert into t_backup select * from :old;
    The table has more than 30 columns so I don't want to select them one by one, how can I select all columns?

    Yes, it is possible by writing something like this :
    where col1 = :old.col1; But it is not directly supported. First, we need a package to remember all the OLD records:.... and please see below link for complete code in action :
    http://www.dbforums.com/oracle/925729-trigger-back-up-data.html
    What I am doing here, just copying the code and replacing "emp" with "test" (The table name on which I am going to apply this using notepad find and replace):
    SQL> select * from test_backup;
    no rows selected
    SQL> select * from test;
             A
             1
             2
             4
             5
    SQL> select * from test_backup;
    no rows selected
    SQL>
    create or replace package test_trg_pkg as
      type test_type is table of test%ROWTYPE index by binary_integer;
      test_tab test_type;
    end;
    create or replace trigger test_bds before delete on test
    begin
      test_trg_pkg.test_tab.delete;
    end;
    create or replace trigger test_adr after delete on test
    for each row
    declare
      -- To allow us to select the old values
      pragma autonomous_transaction;
    begin
      select *
      into   test_trg_pkg.test_tab(test_trg_pkg.test_tab.COUNT+1)
      from   test
      where  a = :old.a;  <----- Here you have to give your column name.
    end;
    create or replace trigger test_ads after delete on test
    begin
      for i in 1..test_trg_pkg.test_tab.COUNT loop
        insert into test_backup values test_trg_pkg.test_tab(i);
      end loop;
    end;
    SQL> delete from test where a=1;
    1 row deleted.
    SQL> select * from test_backup;
             A
             1
    SQL> delete from test where a=2;
    1 row deleted.
    SQL> select * from test_backup;
             A
             1
             2
    SQL>Regards
    Girish Sharma

  • How to get Select All or select Multiple columns  in OOALV

    HI Experts
    i'm assignig internal table to dynamic internal table(FS_IST_TABLE) for to display the output.
    but i'm not geting the Select ALL Option. and i can't select multiple columns at a time.
    where i can select only one column.
    how can i select multiple columns.
    please any one help me.
    regrads,
    rathan.

    Hi,
      If we want to select the multiple columns in the alv by using ooabap
    so in the class CL_GUI_ALV_GRID  it is having one method SET_TABLE_FOR_FIRST_DISPLAY
    it is having one importing parameter IS_LAYOUT of type lvc_s_layo type
    and this structure contains one field SEL_MODE and set that field value as 'A'.
    then we can select the multiple rows in alv grid

  • How do I select multiple columns in a recordset

    I am very new to Dreamweaver/PHP/MYSQL
    I have created my recordset but I cant work out how I select multiple columns.
    How do I select multiple columns, I want to search for data that is spread over different columns.
    My recordset looks like this just now.
    SELECT *
    FROM names
    WHERE nameone = john
    I have 11 columns where the name john my or may not appear so how would I select all the columns. What would the recordset look like.
    As I have said I,m very new to this  and forgive me if what i have just said makes no sense.
    Thanks

    >I have 11 columns where the name john my
    >or may not appear so how would I select all
    >the columns. What would the recordset look like.
    You could try a Full-Text search (if mysql supports it) but on the surface, this sounds like a badly designed data structure. What does your database and table design look like?

  • What is the difference betwwen SELECT ALL Column and Select Speceific Colum

    Hi All,
    If the block size of the database is 8K and average row length is 2K and if we select all column of the table the I/O show that it had read more blocks then compare to
    specific column of the same table. Why is this?
    Secondly if Oracle brings a complete block is the db buffer cache, while reading block from disk, they why there is a difference of block count in two queries.
    This difference reveals to me when I check the EXPLAIN PLAN for two different queries against the same table but one select all columns and the other one select specific column.
    Kindly help me in clearing this confusion.
    Regards,
    Kamran

    user1514587 wrote:
    >
    Usually, indexes are smaller (contain fewer blocks) than the table - ergo, select empno from emp could be satisfied by reading fewer blocks.
    what if there is a composite Index on a table containing 3 to 4 columns and the size of table is in 100 of GB and Index size itself is vey large then I think Oracle will go for FTS and small Index scan will be expensive. Kindly Share your thoughts.
    Regards,
    KamranHandle:     user1514587
    Status Level:     Newbie (5)
    Registered:     May 9, 2011
    Total Posts:     21
    Total Questions:     13 (12 unresolved)
    I think you wastes everyone's time here since you rarely get answer to any posted question

  • Preview's PDF text select ignores columns and misses word spaces

    I have a number of scanned pdf newspaper articles that I was attempting to copy the text from. Preview appears to register the existence of columns, as there is a pale blue background between the columns.
    However when I use the text select tool, it completely ignores the column - and just selects across all columns. And when I paste the text into my text editor, it's missing all the spaces between the words, and the font size is always huge.
    Conversely, Adobe reader in XP has no problem selecting by column, and the pasted text is also an exact replication of the original content. I don't know why Preview performs so badly in this regard? Anyone else experience any issues with pdf text select?

    Anyone else experience any issues with pdf text select?
    Yes, and not just recently.
    There is a reason Preview is named, well, preview. It is not an authoring environment and PDFs are not meant to serve in that context either...unless maybe you understand all of inherent the font traps, tricks & tips and how to tune your scanning/OCR software to keep rework to a minimum.
    Scanning PDFs is always tricky, and without the occasional heavy metal to bring to the task, it just seems to be that more problematic.
    Keep trying, but I'd really suggest to look to other tools at this time.

  • SAPGUI JAVA 7.10 (OSX 10.5.1): cannot select multiple columns in ALV

    Hi,
    in sapgui java 7.10 (on mac osx 10.5.1) I cannot select multiple columns in ALV reports.
    I can do it only in some transactions (like SE16). But on all our custom reports (REUSE_ALV_GRID_DISPLAY) in does not work.
    Any hint?
    Many thanks,
    Lorenzo

    Hi Lorenzo,
    did you double check if selecting multiple columns works with SAP GUI for Windows in the same report?
    If yes, I suggest to file a bug report so we can do a remote logon to run your custom report.
    If not it might be because of REUSE_ALV_GRID_DISPLAY itself or your parameters calling REUSE_ALV_GRID_DISPLAY.
    Best regards
    Rolf-Martin

  • How to create a Type Object with Dynamic select query columns in a Function

    Hi Every One,
    I'm trying to figure out how to write a piplined function that executes a dynamic select query and construct a Type Object in order to assigned it to the pipe row.
    I have tried by
    SELECT a.DB_QUERY INTO actual_query FROM mytable a WHERE a.country_code = 'US';
    c :=DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(c,actual_query,DBMS_SQL.NATIVE);
    l_status := DBMS_SQL.EXECUTE(c);
    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.DEFINE_COLUMN(c,j,v_val,2000);
    END LOOP;
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.COLUMN_VALUE(c,j,v_val);
    END LOOP;
    But got stuck, how to iterate the values and assign to a Type Object from the cursor. Can any one guide me how to do the process.
    Thanks,
    mallikj2

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • Selecting all columns from table in a model query

    I have written a model query which joins 4 tables, applies some rules and returns updated rows by selecting 4 columns out of this. Currently it works fine because all 4 columns are from MODEL aliases. Now I need to select 16 more columns in the same query but none of these columns is added in MODEL aliases. When I tried selecting these columns I got oracle error ORA - 32614. Can someone please guide me to include these columns in the same model query?
    I tried couple of options but no luck. Here are those options for ready reference:
    1. I cannot nest existing model query into another select because there are no columns avaiable to join in output of current query to map with other records.
    2. I cannot include all 16 columns in MODEL aliases because some of these columns are actually output of user defined functions.
    I am using Oracle database version 11g Release 11.2.0.1.0.
    Edited by: Anirudha Dhopate on Jan 23, 2011 5:43 PM

    Thank you Avijit for your reply. There is a syntax error on the ON in this part of the statement which I don't know how to fix - I tried messing around with another INNER JOIN but am not confident that I'm doing the right thing:
    SENAlertType.SENAlertTypeIDONClassMember.ClassMemberStudentID
    Thanks for your help! I will need to do some more bedtime reading on joins.
    Daniel

  • Selecting Multiple Columns in Segment's Column Formula of BIEE Marketing

    Hi all,
    in BIEE 10.1.3.3.1 Marketing Tool we are having problems creating a segment.
    We need the possibility to create a segment filter that contains for example the sum of two different columns ( Num SMS 1 month ago + Num SMS 2 months ago > 100).
    In the "Edit Column Formula Window" the user would like to add the columns from the left panel (like it is suggested in the edit column formula) but this seems to not work, instead when a column is selected a new "Create/Edit Filter" window pops up, therefore the selected column is not inserted in the "Edit Column Formula". We have also tried selecting the "Columns" button but no columns appear ("None").
    We have a work around to this but we can only do it by editing the column formula and adding manually the 2nd column and this is not very user-friendly.
    Does anybody have any suggestions?
    Thank you in advance for your help

    Hi all,
    in BIEE 10.1.3.3.1 Marketing Tool we are having problems creating a segment.
    We need the possibility to create a segment filter that contains for example the sum of two different columns ( Num SMS 1 month ago + Num SMS 2 months ago > 100).
    In the "Edit Column Formula Window" the user would like to add the columns from the left panel (like it is suggested in the edit column formula) but this seems to not work, instead when a column is selected a new "Create/Edit Filter" window pops up, therefore the selected column is not inserted in the "Edit Column Formula". We have also tried selecting the "Columns" button but no columns appear ("None").
    We have a work around to this but we can only do it by editing the column formula and adding manually the 2nd column and this is not very user-friendly.
    Does anybody have any suggestions?
    Thank you in advance for your help

  • Dynamic selection of columns in report and print the output

    Hi,
    I tried to have dynamic selection of columns in SQL query using lexical parameter. The hitch is how to print those selected column in excel ouput ?
    Suppose
    I have select &col from table_name
    Initial value of &col is col1 and in data layout only col1 appears
    where &col was replaced with more than a column (col1,col2,col3)
    now how to print the column selected at the run time,
    i have coded in Before Report Trigger
    :cell_val := ' <td><rw:field id:"cl1" src="col1"></rw:field></td>
    <td><rw:field id:"cl2" src="col2"></rw:field></td>
    <td><rw:field id:"cl3" src="col3"></rw:field></td> ' ;
    and this user parameter was replaced in web source using JSP expression
    <rw:getvalue id: "v_cell" src:"cell_val"></rw:getvalue>
    <rw:foreach src:"g_val">
    <table>
    <tr>
    <% =v_cell%>
    </tr>
    </table>
    </rw:foreach>
    but in the output i can see only blank columns
    Regards
    Suresh

    The strings replaced by expression <%= v_cell %>
    should print the field values contained in col1,col2,col3 columns, but nothing is printed . i think the custom tags (rw...) are not replaced by the jsp expression properly.

  • Problem selecting a column

    According to the user guide:
    "1. Select any table cell so that the reference tabs are showing.
    2. To select a column, click its reference tab (above the column)."
    When I do that the whole table is selected. Is this a bug or am I doing something wrong?

    the image doesn't help me any. i can't select a column and centre it, without all cells in the table being centred.
    I can do it by manually selecting all the cells in the column, but I have 500 + cells to scroll down through and it takes too long.
    I just want to select a column or row and apply a format to it, and I can't do it.
    OK, just found out what my problem was. I had merged several cells to create a row near the top. this was preventing selecting anything below. i took out the merged cells and was able to select a column by clicking on the lower, darker shaded portion of the header.
    Message was edited by: justgetoutandride

  • Number of rows returned by SELECT LAST(column)

    I have about 50,000 rows in my MS Acess database table so I have used SELECT LAST(column) AS newField FROM table... to retrieve the last data in the column however when I check the number of rows in the resultset using
    resultset.last();
         int rowcount = rs.getRow();
    rowcnt returns the total no.rows (about 50,000) in the table.
    I thought it should just return one.
    Is it normal?

    Thanks again dcminta. I'll try with your code.
    I just wanted to know why resultset returned the number of all records in that column when I only selected the last.
    I had the �Invalid Cursor Position� error with "while(rs.next())" as I (thought I) had only one record in the resultset and I was fiddling with my code.
    They are all fine now.
    Thanks guys.
    Booh1(old lady)

  • How to show image in matrix by selecting matrix column type as "it_PICTURE"

    Hi All!
    Can i show image in matrix, by selecting matrix column type as "it_PICTURE". If yes please write the steps.
    Thanks & Regards
    Surojit

    Hi
    First you have to set the matrix column type as it_PICTURE then bind that column to a userdatasource or dbdatasource. In the following code I am using userdatasource . This code will   set the picture to a sepecified columns first row. Please create small image and paste it in your c drive (15X15 size image-- "c:\pic.png")
    Dim oColumn As SAPbouiCOM.Column
                Dim mtxDisp As SAPbouiCOM.Matrix = form.Items.Item("mtxDisp").Specific
                form.DataSources.UserDataSources.Add("udsPic", BoDataType.dt_SHORT_TEXT, 254)
                oColumn = mtxDisp.Columns.Item("colPic")
                oColumn.DataBind.SetBound(True, "", "udsPic")
                mtxDisp.AddRow()
                mtxDisp.GetLineData(1) '*Loads UserDataSources from line X*'
                mtxDisp.DataSources.UserDataSources("udsPic").ValueEx = "c:\pic.png"
                mtxDisp.SetLineData(1) '*Sets Matrix line X based on current UserDataSource values*'
    Hope this helps
    Regards
    Arun

  • Selecting a column in the JTableHeader

    Hi all,
    I am currently working on an application where the user (by d n' d or cut n' paste) should be able to add data to a table. It works fine to add data to the table and display it by using a renderer, but it seems to be impossible to add data to the header. The header won't get selected when clicking on it (and thus never receives the focus...). I have tried various ways of using mouse listeners, overriding the isFocusTraversable() in JTableHeader, setting table.setColumnSelectionAllowed(true), and header.setRequestFocusEnabled(true), but nothing is working. How on earth can I select a column header?

    You definitely will have to roll your own: as is JTableHeader does not support the notion of selection.
    To do so, you will need to change several things:
    1. make the XXTableHeaderUI aware of selection (it always sends false for both isSelected and hasFocus when it repaints the renderer)
    2. have a custom headerRenderer that respects the flags selected/focus
    3. make some object responsible for sending notification if the value for the columnHeader does change - as is the columnNames are stored in the TableModel, but nothing happens when they are changed; so easiest would be to make a customTableModel responsible for firing some event.
    4. make the header listen to the changes.
    As you see, it's quite involved. Good luck
    Jeanette

  • How to programmatically select a column in a JTable

    Hi,
    I'm writing a program which requires me to select a column in the JTable through code. The problem is that I could only find getSelectedColumn() function in JTable and no setSelectedColumn().
    Please let me know if there is any workaround for this.
    Regards,
    Derreck

    Hi,
    table.setColumnselectionInterval(index0,index1);
    The above line will suffice your requirement.
    Cheers,
    Gokul.

Maybe you are looking for

  • Line wrapping and scrolling in JPanel

    Hello, I've got an empty JPanel to which I want to add an (unknown) number of JLabels. Each JLabel has a text which is just one word. When my program is adding JLabels to the JPanel, I want it to have the same behaviour as a normal text editor: when

  • Get Temporary Internet Files Location

    Hello, I'm writing an applet for which it would be useful to have "temporary-ish" storage. What I mean by this is, it would be good to store some settings so that the next time the applet is loaded, I might be able to re-load them. If they're not the

  • Error when compiling the J2ee tutorial source files

    HI, I have installed ant, j2ee tomcat-3.2.2 and jdk1.3 and when i tried to compile the source file downloaded from java.sun by ant converter, it prompted "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/main" I am runn

  • Number Group Not Maintained for Section IEQIN02 and Business Place 194B

    Hi, We have not deducted TDS under 194 B until now but using other sections only like 194 C. Currently there is a deduction under 194 B section and we want to pay through J1INCHLN against this deduction. But we are getting the errror messege "Number

  • Need to help for "blue windos"

    Dear sir, I purchased one HP Laptop hp 650 ci3-2310m(C0S24PA) S.NO.5CB2370MD1  21/07/2013, by one of your authorized  dealers- VIVID IT Solutions pvt ltd Head offiice:BF-130,Shalimar Bagh,delhi-110088 sales office:402,Bjaja House,97,  tel:011-4950209