Query formation

Hi, I'm trying to form the foll. query using Toplink:
SELECT awd.number, awd.amount, SUM(sbg.report_amount)
FROM tbl_sg sbg, tbl_awd awd, tbl_app app
WHERE sbg.report_amount IS NOT NULL
AND awd.gms_awd_id = sbg.awd_id
AND app.app_id = awd.app_id
AND EXISTS
(SELECT '1' FROM tbl_sol sol
WHERE sol.sol_id = app.sol_id
AND sol.reporting = 'Y'
AND sol.entity_id = &ent_id)
GROUP BY awd.number, awd.amount          
ORDER BY awd.number
I define the other select clause "(SELECT '1' FROM..." in a separate ReportQuery. I add this inner query
to the main expression using the "exists(ReportQuery)" api; however this changes the main query to "SELECT ... FROM ... WHERE EXISTS ( (SELECT ...) AND ..."
Can somebody suggest a way to generate the "AND EXISTS" clause successfully?
Thanks
Ajay

Are you using SQL or expressions to define the query?
If you are using SQL, then just include the entire SQL string in the report query, if you are using expressions please provide the expression code that you are using.

Similar Messages

  • Conversion of Mysql query in oracle acceptable query format

    Hi
    I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
    For Example
    Select case_id as 'this is alias' from cases
    The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
    I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
    Please help me in resolving this problem
    Thanks

    The problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
    Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
    The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
    All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all.

  • Difference in Query Formation in different environment in OBIEE 10g

    Hi All,
    I have a report where in I am pulling around 80 columns from different dimension tables and a fact table.
    In QA environment the report takes around 8 minutes and the query formed starts with (a With clause) . The query formed takes around 5 minutes to display the results in SQL developer.
    When i use the same RPD in my local system the same report takes 1 minutes to display and we get a simple query. The query formed in this case just takes 5 secs to display in sql developer.
    My question is why is the difference in the Query formation even if the RPD is same in both the environment.
    Please advice.
    Thanks,
    Krishna

    Hi,
    One of the things I am aware of which controls the usage of WITH clause is few database features parameters which are set up in RPD. You can refer below link for the same.
    http://gerardnico.com/wiki/dat/obiee/vertical_fragmentation_sql
    Also, in the above link, there are some links at the bottom of the page. Those also have some information regarding scenarios where WITH clause is generated and where it is not.
    Thanks

  • Query format in MODBUS RTU PROTOCOL

    Hii
    Pl send me
    1. query format for Modbus RTU Protocol with ODD Parity.
    2. If query goes to instrument using ODD Parity then how to do Error Checking? should it be based on Parity bit checking or based on CRC bits ckecking?
    vijtin

    Hii
    Thanx for support but I have idea regarding error checking methods using Parity or CRC.
    I want to know only query format in Modbus RTU protocol while sending Parity Bit (either odd or even).
    With Parity None my query format is...
    01 03 0001 0002 C40B
    Where 01 is address of device
                03 is readcommand
                0001 is starting location
                0002 is length of data which i want to read
             & C40B is CRC
    Same as above example what will be the query format with Parity EVEN or ODD?
    Plz help me.....
    vijtin

  • SAP Query format issue (with ABAP list)

    Hi All,
    I had a requirement to remove all unecessary formatting and text from a SAP query report which can be read by a third party software system. We need only Header line and  report data (spaced by Tab).
    I have removed all formatting from the report and changed the output format from "SAP list viewer" to "ABAP list" .
    The issue is that the report shows material number with 12 digits in output but when we download to file then it adds extra six "0" and makes the Material Number field as 18 digit.
    we have already maintained new length as 12 againts the standard length 18 for material number(under field output option)
    Please suggest how to get rid of extra digits generated during downloading.
    Please help,
    Thanks,
    Rohit

    Hi Brad,
    Currently we execute query with SQ01 and from the output screen the user direclty saves the file as "local file..."
    The output format is "abap list". We are able to get the exact format but the only problem is with material number. I cant make changes in the program. Is there a way to download it without changing the 12 character ( as displayed on the report output)
    Thanks for help.
    Rohit

  • BEx Query Formating - Displaying both Sum and Average in the same report

    Hi everybody,
    I need to create a BW report in the below format,
                          Company Code                                            Total       Total Average
                                   0001            0002      0003      0004
    Doc Type
        AV                        10               10         10         10            40                 10
        RV                        20               20         20         20            80                 20
    Getting the report till the 'Total' column is easy but having the 'Total Average' as a separate column is where I am stuck.
    Having the company code in the rows, and not clolumns, would have solved the issue but I need to keep the above format. Also I do not want to
    see the Total Average for every Company Code, just that of the 'Total'.
    In the Query Designer, in the Column section I have first the 'Company Code' and then the 'Count' in a structure, so whatever I add to this structure,
    is displayed for each Company Code, that means 2 columns for each Company code. This changes the format.
    I cannot use the Cell Definition method here, as then it would be a static structure and the number of Company Codes are not fixed.
    It would be great if somebody could provide some suggestions.
    Thank you,
    Ajay

    Hi Suman,
    Thanks for the quick reply.
    I have tried this, but again this will change the format. With the way you said, I will only get the report in the below 2 formats,
    1. Company code in Free Charac, later drill down to Rows,
    Doc Type  Company Code  
        AV                 0001                10
        AV                 0002                10
        AV                 0003                10
        AV                 0004                10
        Total                                      40
        RV                 0001                20
        RV                 0002                20
        RV                 0003                20
        RV                 0004                20
        Total                                      80
    or 2. Company code in Free Charac, later drill down to Column,
                      Company Code                                       
                               0001                     0002                     0003                     0004    
                        Total    Total Avg   Total   Total Avg   Total   Total Avg  Total   Total Avg
    Doc Type
        AV             10           10             10         10           10         10           10           10
        RV             20           20             20         20           20         20           20           20
    Both the above are different from the format that I need.

  • Oracle 10g Query Format

    0
    down vote
    favorite I am using oracle 10g. I have a temp table TEMP.
    TEMP has following structure:-
    USER COUNT TYPE
    1 10 T1
    2 21 T2
    3 45 T1
    1 7 T1
    I need a query which will show all types has column names,and types can be any value like T1,T2,..Tn and columns will be like:-
    USER T1 T2 Tn
    and User column will show all the users and T1,T2 column will show total count of types.
    Edited by: 969468 on Nov 15, 2012 9:35 PM

    Please see my original post ("I have a page erroring in production (but not in development) when it gets to a date that it needs to display.")  Sorry if it came across as vague.  It made sense, to me, when I typed it.  But, then, I'm usually typing fast just to get the question out there, when I'm in a hurry.
    Haven't done a CFDUMP, yet, as every time I make a change in development that needs to be tested in production, I have to notify my supervisor that there are files that need to be copied into production, which can sometimes take a while, so I try to do troubleshooting on dev side - it's a pain in the you-know-what, but that's the kind of environment I'm working in.
    As it turns out, changing the format in the SELECT to_char() did the trick.  If anyone else has this issue with Oracle 10g, I'm now using SELECT to_char(create_date,'YYYY/MM/DD HH:MI') FROM tableA, and now the CFOUTPUT is processing the whole page.  I guess the MM-DD-YYYY threw CF into a tizzy, breaking the process?
    Anyhoo, it's working, now.  Thank you, Dan and Adam, for your thoughts on this.
    ^_^

  • Query - Formatted Search in a User Defined Field

    Hi,
    I am having some problems with a very simple query but it doesn't seem to work. I insert this formatted search in to my UDF I made called Cost. The query I am using is:
    SELECT  $[$34.0.0] - (I had to use variable number because this Unit Price field in the Item master data does not have a field name associated)
    It is supposed to grab the unit price from the screen, however it is always displaying zero when I query it, and when I put it in the UDF as a formatted search, it give me the internal error.
    I would greatly appreciate your help.
    Thanks

    Question 1: Where is this Cost UDF defined.  Is it at the Marketing document Header or row level?
    NOTE:
    The field reference for the Unit Price column is incorrect.  When you mouse over the Unit Price column you should see the values for Item=xx  Colunm=xx
    The syntax is $\[$Item.Column.Type].  Therefore for your case it should be $\[$38.14.Number]
    The type prefix can be 0 if you are accessing a Alphanumeric column.
    If you user field is at the Header level the Formatted Search Query might not work unless you highlight that whole row and then click on the header level UDF and press Shift+F2
    How have you set the refresh options?

  • Saving a query format

    Hi,
    After making changes in the query in Analyzer. I would like all my queries to appear the same way(same format). However i do not want to repeat all that i did every time i execute a query.
    Is there a way for me to save my format and when i execute the new queries it shows just like i set it in the original one.
    Thanks

    Hi,
      I guess you are talking about the default formatting shown in workbook. See the below thread -
    /thread/444261 [original link is broken]

  • Copying Query & Formatting on Worksheet to New Worksheet in Same Workbook

    Hi,
    Can anyone advise me the quickest way to copy a query that is working on one worksheet to a new worksheet. More importantly how do I retain the formatted features of the worksheet from which I am coping from? I have tried to copy the query to a new worksheet which is OK but I cannot seem to retain the format features from the original worksheet. Am I missing something simple?  We are on version 3.5.
    Thanks

    Shanky_621: Thanks for taking the time to help. The following blog article talks about what I'm trying to do:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;914288
    The goal is to recreate the inefficent plan on a test database without copying the data. The article talks about this as a "statistics only copy".
    You noted, "SQL server generating query plan is internal mechanism into which we cannot interfere unless we use Query hint...". The engine uses statistics and histograms to generate plans then choose the most efficent one for execution. Those statistics
    are generated from data in the database, and that process is done periodically. You don't think the engine actively scans each table in a query each and every time a query is run? Right! That would be crazy. It just checks the stats. What I'm trying to
    do is pull the stats from one database into another. The article does a better job explaining this.
    JRStern (Josh): Yes brother! You understand what I'm trying to do. Like you, I am wrestling with a feature/process I've only read about. The actual execution is... not as expected. I actually just found the article I noted to Shanky. I'm trying that process
    now. I'll tell you how it goes.
    Adam

  • Web Service to xml to bls to xacute query formatting

    Hi.
    I have a BLS calling a web service which returns a data set in the xMII XML format. I take that output and put it in a xml transaction output property and try to read it with an xacute query. (obviously I will be doing more manipulations to the data in the bls once i get this issue resolved). The query returns a blank page when tested.
    OK, so I take the same xml output, and in the same bls use the Write_File action to create an xml file, then use the XMLLoader action to read in that file back into the bls, assign the results of the xmlLoader to the xml transaction output property and try to read that output with an xacute query. I get the data when I test the query.
    Now, I don't touch the format between the web service and the file or after I load the file. How come the xacute query can read one transaction output and not the other?
    I have taken both transaction propertie values from a trace log and compared the strings and find no difference between the return from the web service and the result of the xmlLoader. I don't want to take the output of the web service and write it to a file just to get in into an xml format that works properly.

    I am sure that is the root cause, but how do I do an explicit type conversion without going through the output to file and load xml step? What else is needed?
    The return of the Web Service is an XML that contains an XML string in the xMII format. I can look at that string and it looks correct (Though xacute doesn't recognize the string as an xml structure). I can take that string and put it in an XML transaction property and it looks correct (the reference in the BLS is: SqlXml2.SQLXML2Response{/ns1:SQLXML2Response/ns1:SQLXML2Return}). I can take that XML variable and output to a file and then load that file and it actually is correct (though the content of the file and the return string from the web service are identical). So, I can see that the type conversion takes place when I load the xml file but I haven't found the action that will do the type conversion otherwise even though the "conversion" doesn't seem to require changing the content at all. Have I missed something?

  • Date query format?

    I have a query that I've isolated to a specific part giving back a funny answer. for example,
    when I do this
    SELECT TO_DATE (MAX (D_DTM))
                                FROM DMSN.DS3R_FH_1XRTT_FA_LVL_KPII get back 4/23/2013 which is almost correct, max date in the data set is actually 4/23/2013 12:00:00 PM
    so when I do this
    SELECT TO_DATE (MAX (D_DTM), 'DD/MM/YYYY HH24:MI:SS')
                    FROM DMSN.DS3R_FH_1XRTT_FA_LVL_KPII get back 4/23/0013? this is odd, why the year 0013? I'm assuming its my format?
    Edited by: k1ng87 on Apr 23, 2013 8:02 PM

    Hi,
    Ed is right. Think of the name of the function: TO_DATE converts a string TO a DATE. The first argument to TO_DATE is supposed to be a string. If you pass something else, it will be implicitly converted to a string. Don't use implicit conversions; the results might not be what you expect. If you need to call a function (in this case, you*don't* need to call TO_DATE), then call it with the correct types of arguments. If you really need to convert from one data types to another, then explicitly use a conversion function, or CAST.

  • Query Formating Time is more

    Dear Friends,
    I have one stock report, it is genarally executs with in 10 to 15 mints, but now it is taking too much time to give output, it is taking more time for Formating the report. I created Indexs and DB stats for that cube, so please give me some solution for this problem.
    Thanks
    Ganga

    Hi Ganga,
    Check this might be useful:
    http://help.sap.com/saphelp_nw04s/helpdata/en/a0/2a183d30805c59e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/57/b10022e849774f9961aa179e8763b6/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3f66ba90-0201-0010-ac8d-b61d8fd9abe9
    http://help.sap.com/saphelp_nw04s/helpdata/en/2e/caceae8dd08e48a63c2da60c8ffa5e/frameset.htm
    Hope this helps............
    Rgs,
    I.R.K

  • OBIEE SQL Query formate problem

    Hai All,
    i am tring to see viewlog in obiee it is givinn the following formate.
    WITH
    SAWITH0 AS (select sum(T338777.CST) as c1,
    sum(T338777.FINAL_INVOICE_AMT) as c2,
    T66199.X_DISP_FSCL_YEAR as c3,
    T66199.FSCL_MONTH as c4,
    substr(T66199.MONTH_NAME , 1, 3) as c5,
    T37817.NAME as c6,
    T101991.NAME as c7,
    T66199.FSCL_YEAR as c8,
    T101991.ROW_WID as c9
    from
    W_INT_ORG_D T37817,
    W_ORG_D T101991 /* Division (W_ORG_D) */ ,
    W_MONTH_D T66199 /* Generic Month (W_MONTH_D) */ ,
    WC_INVC_SPARES_PO_A T338777 /* Spare PO(WC_INVC_SPARES_PO_A) */
    where ( T37817.ROW_WID = T338777.ORG_WID and T66199.ROW_WID = T338777.MONTH_WID and T66199.X_DISP_FSCL_YEAR = '2010-11' and T101991.ROW_WID = T338777.DIVN_WID and T101991.DIVN_FLG = 'Y' )
    group by T37817.NAME, T66199.FSCL_MONTH, T66199.FSCL_YEAR, T66199.X_DISP_FSCL_YEAR, T101991.NAME, T101991.ROW_WID, substr(T66199.MONTH_NAME , 1, 3))
    I need the  following formate. what should i do?
    select sum(T338777.CST) as c1,
    sum(T338777.FINAL_INVOICE_AMT) as c2,
    T66199.X_DISP_FSCL_YEAR as c3,
    T66199.FSCL_MONTH as c4,
    substr(T66199.MONTH_NAME , 1, 3) as c5,
    T37817.NAME as c6,
    T101991.NAME as c7,
    T66199.FSCL_YEAR as c8,
    T101991.ROW_WID as c9
    from
    W_INT_ORG_D T37817,
    W_ORG_D T101991 /* Division (W_ORG_D) */ ,
    W_MONTH_D T66199 /* Generic Month (W_MONTH_D) */ ,
    WC_INVC_SPARES_PO_A T338777 /* Spare PO(WC_INVC_SPARES_PO_A) */
    where ( T37817.ROW_WID = T338777.ORG_WID and T66199.ROW_WID = T338777.MONTH_WID and T66199.X_DISP_FSCL_YEAR = '2010-11' and T101991.ROW_WID = T338777.DIVN_WID and T101991.DIVN_FLG = 'Y' )
    group by T37817.NAME, T66199.FSCL_MONTH, T66199.FSCL_YEAR, T66199.X_DISP_FSCL_YEAR, T101991.NAME, T101991.ROW_WID, substr(T66199.MONTH_NAME , 1, 3))
    Regards,
    Ram

    Hi,
    You messed up with database features in OBIEE rpd. Check the below link
    http://gerardnico.com/wiki/dat/obiee/vertical_fragmentation_sql
    Regards,
    Sandeep

  • Query format

    I HAVE A TABLE LIKE THIS
    No Name C1 C2 C3
    1 ABC 10 20 50
    2 DEF 30 60 30
    3 EFG 90 80 10
    4 IJK 60 20 99
    AND I NEED OUTPUT AS LIKE - PUT 'Y' WHERE THE GREATEST VALUE IN A ROW
    AND ELSE 'N'.
    AS.......
    NAME C1 C2 C3
    ABC N N Y
    DEF N Y N
    EFG Y N N
    IJK N N Y
    THE OUTPUT MUST BE ONLY THROUGH A QUERY NOT USING A BLOCK ...... IT POSSIBLE THROUGH NESTING THE DECODE FUNCTION BUT I DONT KNOW HOW .........
    PLEASE HELP ME................

    Use GREATEST Function and DECODE.

Maybe you are looking for

  • Error while posting invoice in f-43 with TDS

    HI Could not determine the year for TDS certificate number range Message no. 8I017 Diagnosis The excise year could not be determined for generating the numbers for TDS Certificates. The number range is linked to the Excise Year and not on the financi

  • Document lost / Pages for iPad

    Hello, I have created a file on Pages for iPad (iOS 7.1) yesterday. The app was not allowed to backup documents on iCloud. It was saved automatically and then being imported as PDF and sent as mail. Now I can not see the doc in Pages overview anymore

  • RSCRM_BAPI and Start Condition after Event

    Hello all I have a process chain set up that loads data to cubes. I wish to run RSCRM_BAPI after a certain cube has loaded. I create the extract in RSCRM_BAPI and for the START condition I use 'After Event' does anyone know if this is correct and if

  • Essbase migration from system 7.x to 11.x system

    Hi, Please i need help ! I want to migrate the essbase applications from 7.x system to 11.x system not by using the wizard. Just i want to do it using the batch script in windows environment. Please send the script with one example. Thanks in advance

  • What do you use to create distributable packages with ARD?

    What do you use to create distribution packages for ARD? I.E. a package for installing the new Oracle Java 7.21 on all our machines. Or, a package for installing Micosoft Office 14.3.2 udapters? Specifically for 10.7 and 10.8 users. Install Ease? Jam