Problem with dg4msql and table-valued functions

Have configured dg4msql to connect from my oracle db to ms sql server.
Am able to do simple SELECTs from ms sql tables like:
select * from "sys"."procedures"@dg4msql;
or
select * from "dbo"."SomeTable"@dg4msql;
But am unable to do a SELECT from a table-valued function:
select * from "dbo"."GetData"@dg4msql('param1value');
or
select * from "dbo"."GetData"('param1value')@dg4msql;
In both cases I get:
ORA-00933: SQL command not properly ended
It does not like the parameters portion of the query ("('param1value')")
initdg4msql.ora:
HS_FDS_CONNECT_INFO=[svr1]//mydb
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_PROC_IS_FUNCT=TRUE
HS_FDS_RESULTSET_SUPPORT=TRUE
Have tried the other set of params:
HS_FDS_PROC_IS_FUNCT=FALSE
HS_FDS_RESULTSET_SUPPORT=TRUE
Same story. After changing the init*** file have bounced both Listeners (DB and Gateway), reconnected, and re-run the query.
Have I missed something?
Any help is greatly appreciated!

Sorry, but for me it looks you did not get the problem.
Oracle® Database Gateway for SQL Server User's Guide,:
11g Release 2 (11.2)
Part Number E12069-02
*2 SQL Server Gateway Features and Restriction*
Result Sets and Stored Procedures
The Oracle Database Gateway for SQL Server provides support for stored procedures which return result sets.
By default, all stored procedures and functions do not return a result set to the user. To enable result sets, set the HS_FDS_RESULTSET_SUPPORT parameter value to TRUE.
PL/SQL Program Fetching from Result Sets in Sequential Mode
-- Execute procedure
out_arg := null;
refcurproc@MSQL('Hello World', out_arg, rc1);
Somewhere in this forum I've seen a message that the syntax "SELECT ... FROM sp@db(param1, param2)" works.
Anyway, even with the PL/SQL block the error message is the same - ORA-00933 "SQL command not properly ended"
and the cursor (* in SQL*PLUS) is put just at the first bracket.
Edited by: user636213 on Aug 10, 2012 5:17 AM

Similar Messages

  • Problem with QofQ and Null Values

    Just converted from CF5 to CF7. Finally figured out what was
    causing the error message :
    "The value "" cannot be converted to a number" when running a
    QofQ. It happens whenever there is a NULL (and I think a ZERO)
    value in the QofQ. I'm using the QofQ in a seperate chart program.
    The main query merges data from a store and a region table.
    I'm doing a LEFT OUTER JOIN to combine the REGION with the STORE,
    AND so that stores with NO SALES for a given day will show up as
    ZERO. On the main report, when I don't use a QofQWhen grouping by
    DAY or MONTH, I can test the value in the CFOUTPUT for NULL or ZERO
    and display "0" or "N/A" on the report.
    But when I try to chart it, using a QofQ to read in the
    values from the main query, and format the numbers, I get this
    error message. I've tried using the CAST function, using FLOAT,
    DOUBLE, BIGINT, etc., but still get same error message.
    The only way I could fix this is to add a WHERE statement to
    the QofQ, that only includes sales values greater than ZERO. But
    then, I have gaps in my chart because stores with NO SALES for a
    given day or MONTH don't appear. Because they are removed from the
    query. The whole point of LEFT JOINS is to include items with no
    values (or NULL) values.
    Does anyone know if it's possible to keep these values in a
    QofQ? So that items (e.g., store locations in my case) with NULL or
    ZERO values for some or all days or months can be charted? Even
    with a ZERO value? I've read everything I can get my hands on
    regarding QofQ, the CAST function, etc., but nothing seems to work.
    Thanks for any help. (FYI, didn't have this problem with CF5. It's
    QofQ could handle NULL or ZERO values without providing an error).
    Gary

    Well, I tried the IsNull function on the 3 SUM() values I was
    calculating in my SELECT statement (on a LEFT OUTER JOIN QUERY),
    and I STILL got another "cannot convert "" to a number" but this
    time the error message was more direct, and pointed me to a DATE
    field in my query, where I was SORTING AND GROUPING either by DAY
    or MONTH (depending on what user selected on form).
    In my QofQ, I'm not just reformating the integer SUM()
    values, but also the date values. So, I applied the IsNull()
    function to the DATE values in my main query. I still kept getting
    errors. But after experimenting ((SQL Server BOL docs doesn't give
    ISNULL() examples for DATE FIELDS, only NUMBER fields), I tried
    putting the dates in SINGLE QUOTES in my IsNull() function, the
    QUERY RAN. Then I wasn't sure WHAT date to enter, e.g., 1/1/1889 or
    1/1/2001, etc.
    Then, I discovered, after experimenting, that you cannot just
    blindly enter ANY date when using IsNull in a date field,
    especially if you are using CFGRAPH to chart the results by day.
    You have to select a date within the date range the user selected,
    so this means using the FORM.DATE (or URL.DATE) value from the
    form. Here's the working example from my SELECT main query:
    SELECT SUM(ISNULL(d.ttldb,0)) AS SumOfDB,
    SUM(ISNULL(d.ttldbv,0)) AS SumOfDBV,
    SUM(ISNULL(d.ttldbi,0)) AS SumOfDBI,
    <CFIF '#url.reptype#' IS "DAILY">
    ISNULL(d.depday, '#url.date1#') AS depday
    <CFELSE>
    month(ISNULL(d.depday, '#url.date2#')) AS TranMonth,
    year(ISNULL(d.depday, '#url.date2#')) AS TranYear
    </CFIF>
    Then I discovered that whatever date was used in the URL.DATE
    field (in my case it would be one of the two date field from the
    form, and depended on whether you coded DATE1 or DATE2, the chart
    would always show ZERO values for that date. So I tried putting the
    IsNull() date values in the GROUP BY and ORDER BY statements, e.g.,
    <CFIF '#url.reptype#' IS "DAILY">
    GROUP BY ISNULL(d.depday, '#url.date1#')
    ORDER BY ISNULL(d.depday, '#url.date1#') DESC
    <CFELSE>
    GROUP BY year(ISNULL(d.depday, '#url.date2#')),
    month(ISNULL(d.depday, '#url.date2#'))
    ORDER BY year(ISNULL(d.depday, '#url.date2#')),
    month(ISNULL(d.depday, '#url.date2#'))
    </CFIF>
    And this worked. The report ran just fine, and the chart
    charted every value correctly.
    I guess you have to learn all the little "quirks" about CF7
    and how it's QofQ and chart programs work. But so far, so good.
    Thank you all for your help. Now I've got to update other old
    CF5 programs that are returning errors when there are null values
    from my LEFT OUTER JOIN queries. Will take some time, but at least
    I know how to do it. Thanks to your help.
    I really appreciate your time and efforts to help with this
    issue.
    Gary

  • Problem with inheritance and outputting values in toString.

    Hey guys, i'm having a major problem with inheritances.
    What i'm trying to do with my program is to create objects in my demo class. Values are passed to several other objects that each do their own calculations of grades and results and then outputs the result in my toString. I followed step by step the instructions in my book on how to setup the inheritance and such. I can only output everything that was created in my superclass, any other thing that was created in an object that belongs to a subclass does not display in the output at all.
    Even if I change or create new instance variables, I can't figure out for the life of myself how to output the other values.
    Because there's so much code to be splitting on the forums, I zipped my whole project in a RAR. I'll link it here
    http://www.4shared.com/file/ZleBitzP/Assign7.html
    The file to run the program is CourseGradesDemo class, everything else is either a subclass or superclass to some part of the program. After you run CourseGradesDemo, you will see the output, and understand what displays and what stays at 0.0 value. If anyone can help me out with this it would be greatly appreciated
    Thanks in advance.

    Basshunter36 wrote:
    Hey guys, i'm having a major problem with inheritances.
    What i'm trying to do with my program is to create objects in my demo class. Values are passed to several other objects that each do their own calculations of grades and results and then outputs the result in my toString. I followed step by step the instructions in my book on how to setup the inheritance and such. I can only output everything that was created in my superclass, any other thing that was created in an object that belongs to a subclass does not display in the output at all.
    Even if I change or create new instance variables, I can't figure out for the life of myself how to output the other values.No idea what you're talking about. Provide an [url http://sscce.org]SSCCE.
    Because there's so much code to be splitting on the forums, I zipped my whole project in a RAR. I'll link it here
    http://www.4shared.com/file/ZleBitzP/Assign7.html
    Not gonna happen. Provide an [url http://sscce.org]SSCCE. And don't say you can't. You definitely can. You may have to spend an hour building a new program from scratch and getting it to reproduce the problem, but if you can't or won't do that, you'll find few people here willing to bother with it.

  • Problems with convertNumber and Double values

    I've serious troubles using convertNumber with Double data in input fields.
    While output formatting works fine, the outputted string fails to be converted back - I get conversion errors.
    So the value that is written to the input field generates a conversion error being submitted! This is not good practice!
    I've found out the following: (I use german locale, so following examples containing ',' means decimal point)
    <f:convertNumber pattern="##0.00" />generates the right output, eg. for Double(20.50) - "20,50", but this value ("20,50") will not be parsed using the above pattern! Only values with non zero last minimum fractional digit (eg "20,51", "20,59", ... ) will be parsed!
    In addition, the above pattern doesn't parse numberstrings that don't contain all significant digits.
    For example an input of "20" will not be parsed to "20.00"!
    Maybe this is not the right forum for that problem, since i think this is a general java formatting problem (?).
    But as the problem arised by using the convertNumber tag and acting like this on numeric input fields is not very comfortable, I liked to post this here. Maybe someone can give me some advice?

    I also have found this problem, except that in my experience it is the decimal part that must be non-zero, not just the last digit of the decimal part. So with a pattern of "0.00" the string "1.50" (one and a half) will be accepted whereas the string "1.00" will not.
    My guess (just a guess) is that it is related to the documented behaviour of the DecimalFormat object when it parses a number. According to the documentation:
    The most economical subclass that can represent the number given by the string is chosen. Most integer values are returned as Long objects, no matter how they are written: "17" and "17.000" both parse to Long(17). Values that cannot fit into a Long are returned as Doubles. This includes values with a fractional part, infinite values, NaN, and the value -0.0. DecimalFormat does not decide whether to return a Double or a Long based on the presence of a decimal separator in the source string. Doing so would prevent integers that overflow the mantissa of a double, such as "10,000,000,000,000,000.00", from being parsed accurately. Currently, the only classes that parse returns are Long and Double, but callers should not rely on this. Callers may use the Number methods doubleValue, longValue, etc., to obtain the type they want.
    Which means that "1.50" will be returned as a Double while "1.00" will be returned as a Long. Perhaps there is then a class-cast exception whie trying to use this value?
    If this is indeed the problem, the solution is to use the getDouble() method of the parsed Number to create the Double to be returned, but this is for the implementer to do - not the user!

  • I am having problems with copy and then paste function

    Within the past month, I noticed that I am having a problem with my copy and paste function on my IMAC.  I have an intel based IMAC with the Mac OS 10.5.8 running.  Is there anyone experiencing this problem?  Any assistance, recommendations?

    Then try a SMC reset:
    Resetting the SMC (System Management Controller) on Intel-based Macs:
    http://support.apple.com/kb/ht3964  and
    http://support.apple.com/kb/HT1237?viewlocale=en_US
    Resetting your Mac's PRAM and NVRAM:
    http://support.apple.com/kb/ht1379

  • Problem with Sections and Table of Contents

    I have just purchased pages. Both my iMac and MacBook have Lion. I do not have the "sections" button on the toolbar. When I open the "inspector" and try to insert a Table of Contents, the "paragraph styles" pane is empty. How can I correct these problems as I would like to use pages for a family story

    You have started your document with a Page Layout template. TOC doesn't work with text boxes. You need to use a Word Processing document and have the text in the main text layer.
    In the New from Template Chooser you can see the types in the left side bar.

  • Problem with MessageArea and Table

    Hello all,
    i have a form with a Table and MessageArea on it. If the user input something in the Table and click Save, all fields will be checked and the MessageArea shows the errors, in case of any errors.
    If I click on one of the listed messages, I will see the Tooltip near the field I made mistake.
    The problem is, if I input some wrong data into the table and then using navigation buttons on the table navigate to the end of the table and then click Save, I will see Error Messages in the MessageArea, but if I click on the message, nothing happens and I don't see any red fields and don't know where was wrong input. So I have to navigate on table and search for this field.
    How can I override OnAction method of the MessageArea? So, if someone click on an error-message of the MessageArea, I can navigate the user to the field with an error (setLeadSelection(i)) and the user will see, where the input was wrong.
    Can I override the Navigation buttons of the Table? In the properties I can define only onFilter onLeadSelect.
    Thanks in advance.

    Hi,
    I think you can use reportInvalidContextAttributeException() method on IWDMessageManager.
    Ex :wdComponentAPI.getMessageManager().reportInvalidContextAttributeException()
    Re: tutorial ErrorBehavior method from tutorial is undefined
    Regards, Anilkumar
    Message was edited by:
            Anilkumar Vippagunta

  • Problem with Div and table

    I have a table that contains data parsed for a weather station page.  It also has a webcam picture on the page.  Up until now, the webcam pic has loaded via an applet but I want to change that to a jquery slideshow so it's accessible to more mobile devices.   My problem is that no matter what I do (aside from putting a 5x240 spacer) I can't get the table data to display below the webcam div (id="featured").  I've put the webcam and data table in their own div, the webcam's div in the table, used clear:both on the divs, tried setting block size, but it's like nothing is working.   So I'm back to go and thought I'd post it here since there are so many folks here who know more about this than me.  This is the html, right now with no CSS classes or anything added.  So whatever you would suggest as far as div and/or table layout and any CSS would be appreciated.
    <table width="100%" cellpadding="3">
    <tr align="center"><td >
          <div id="featured"> <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img0" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-9.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img10" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-8.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img9" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-7.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img8" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-6.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img7" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-5.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img6" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-4.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img5" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-3.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img4" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-2.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img3" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-1.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img2" /></a>
                  <a href="http://www.spyglasshill.com/Webcam/" target="_new"><img src="http://spyglasshill.com/Webcam/netcam-0.jpg" alt="Webcam of Holland Channel from Spyglass Condos" width="320" height="253" border="0" id="Img1" /></a>  <!--end div featured--></div>
    </td></tr>
    <tr>
      <td><img src="images/spacer5x260.gif" width="5" height="260"></td></tr>
    <tr>
                          <td colspan="4"><p align="center"><a href="images/06/Waterspout/Waterspouts.htm"><br />
                              </a></p>
                            <div align="center">
                              <p><a href="images/Waterspout/Waterspouts.php">Waterspout on Lake Mich </a>||| <a href="images/ANIFreighter.gif">Freighter Leaving Harbor</a><br />
                              </p>
                            </div></td>
                          </tr>
                        <tr>
                          <td colspan="4" bgcolor="#EAEFF9"><div align="center">
                            <h2>Weather Conditions Last Updated  wvcurudwv at wvcurutwv </h2>
                          </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Temperature                      </div></td>
                          <td><div align="left">                        wvcur01wv                      </div></td>
                          <td><div align="right">                        Wind Speed                      </div></td>
                          <td><div align="left">                        wvcur18wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Average High                      </div></td>
                          <td><div align="left">                        wvahtempwv                      </div></td>
                          <td><div align="right">                        Wind Direction                      </div></td>
                          <td><div align="left">                        wvcur17wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Record High                      </div></td>
                          <td><div align="left">                        wvrhtempwv in
                          wvrhtyrwv                      </div></td>
                          <td><div align="right">                        Peak Wind Gust                      </div></td>
                          <td><div align="left">                        wvhigh18wv at
                          wvhight18wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        High
                          Since Midnight                      </div></td>
                          <td><div align="left">                        wvhigh01wv
                          at wvhight01wv                      </div></td>
                          <td><div align="right">                        Wind Chill Factor                      </div></td>
                          <td><div align="left">                        wvcur02wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Low                      </div></td>
                          <td><div align="left">                        wvlow01wv
                          at wvlowt01wv                      </div></td>
                          <td><div align="right">                        Yesterday Max Wind                      </div></td>
                          <td><div align="left">                        wvyhigh18wv at wvyhight18wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Rainfall Since
                          Midnight                      </div></td>
                          <td><div align="left">                        wvcur16wv                      </div></td>
                          <td><div align="right">                        Relative Humidity                      </div></td>
                          <td><div align="left">                        wvcur13wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Rainfall Yesterday                      </div></td>
                          <td><div align="left">                        wvyhigh16wv                      </div></td>
                          <td><div align="right">                        Barometric Pressure                      </div></td>
                          <td><div align="left">                        wvcur15wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Sunrise                      </div></td>
                          <td><div align="left">                        wvsrisewv                      </div></td>
                          <td><div align="right">                        Heat Index                      </div></td>
                          <td><div align="left">                        wvcur04wv                      </div></td>
                        </tr>
                        <tr>
                          <td><div align="right">                        Sunset                      </div></td>
                          <td><div align="left">                        wvssetwv                      </div></td>
                          <td><div align="right">                        Dew Point                      </div></td>
                          <td><div align="left">                        wvcur03wv                      </div></td>
                        </tr>
                        <tr>
                          <td> </td>
                          <td> </td>
                          <td> </td>
                          <td> </td>
                        </tr>
                        <tr>
                          <td> </td>
                          <td>Moon
                          distance from earth</td>
                          <td><span>wvmdistwv</span></td>
                          <td> </td>
                        </tr>
                        <tr>
                          <td><h2> </h2></td>
                          <td><h2> </h2></td>
                          <td><h2> </h2></td>
                          <td><h2> </h2></td>
                        </tr>
                        <tr>
                          <td><h2><a href="http://www.coastwatch.msu.edu/twomichigans.html" target="_blank">Lake
                            Michigan<br />
       Water Temp</a></h2></td>
                          <td><h2><a href="http://www.woodtv.com/Global/category.asp?C=2906&nav=0Rcf">TV
                          8</a> &amp; <a href="http://www.wzzm13.com/weather/forecast/weather.asp">TV13</a> Weather </h2></td>
                          <td><h2><a href="http://www.deq.state.mi.us/beach/Default.aspx?County=70" target="_blank">Ottawa County Beach Conditions</a></h2></td>
                          <td><h2><a href="http://www.crh.noaa.gov/product.php?site=grr&product=nsh&issuedby=grr" target="_blank">Nearshore
                          Marine Forcast</a></h2></td>
                        </tr>
                      </table>

    Of course as soon as I posted that, I found the error of my ways. I had forgotten to set containerheight:   on my .js script for 'div#featured'
    Arrrghh, why couldn't I have realized that a hour ago!!!

  • Problems with CS5 and font check Function

    There is a function that I have been using that works from cs to cs4 now with cs5 it does not error it just doesn't find all the missing fonts. If anyone is willing to take a crack at this it would be very helpful. Here is the function:
    function myCheckFont(currFile){
        numMissingFonts=0;
        docFonts=app.activeDocument.fonts.everyItem().name;
        appFonts=app.fonts.everyItem().name.join('');
        var numFont = myDocument.fonts.length;
        myFile.write("MISSING FONTS: ");
        for (var loopvar=0; loopvar<docFonts.length; loopvar++){
                if (appFonts.match(RegExp(docFonts[loopvar]))==null){
                    if (myDocument.fonts.item(loopvar).status=="1718832705"){
                        if (numMissingFonts==0){
                            myFile.write(docFonts[loopvar]);
                            numMissingFonts=numMissingFonts+1;
                        else{
                            myFile.write(", "+docFonts[loopvar]);
                            numMissingFonts=numMissingFonts+1;
        if (numMissingFonts==0)
            myFile.write("none");
        myFile.writeln("");
        return [numMissingFonts];

    Hi
    I run this script to same documents both CS4 and CS5,
    and insert the snippet to check status.
    $.writeln(app.activeDocument.fonts.item(loopvar).status);
    font status return differnt value!
    CS4
    missing OpenType Fonts => 1718832705
    missing Composite Fonts => 1718834037
    CS5
    missing CpenType Fonts => SUBSTITUTED (1718834037)
    missing Composite Fonts => SUBSTITUTED (1718834037)
    mg

  • Problem with Cast and table operator

    Hi ,
    Am using Table and cast opertor to fetch the data from a collection using a ref cursor as follows
    OPEN test_cur for
    SELECT first_name, Last_name from table(cast( V_Test_collection as Test_Array));
    This works but when i tried to fetch the date using following query and ref cursor then i received ORA-00604 and ORA 01003.
    I used string containg the query like follows
    V_SQL:= ' SELECT first_name, Last_name from table(cast( V_Test_collection as Test_Array))';
    OPEN test_cur for V_SQL;
    I want to pass this V_SQL variable to another procedure that will use it to apply some business logic.Please help me how to resolve this problem.

    Hi, Current procedure is as follows but as per new requirement i have to pass the processed data from this procedure to a common procedure that accepts the string containing the query(Say IN_QUERY) and applies the business logic by fetching the data from this query(IN_QUERY)
    CREATE OR REPLACE PROCEDURE GET_USER_INFO_PRC(USER_ID IN NUMBER,
    TEST_CUR OUT COMMOM_PKG.OUT_REF_CUR,
    O_ERROR_CODE OUT NUMBER,
    O_ERROR_LOCATION OUT VARCHAR2,
    O_ERROR_MESSAGE OUT VARCHAR2) IS
    V_TEST_COLLECTION COMMOM_PKG.WI_INS_SEARCH_ARR_OBJ := WI_INS_SEARCH_ARR_OBJ();
    BEGIN
    Some buniess logic is applied on V_Test_collection to fetch the date in this block
    OPEN TEST_CUR FOR
    SELECT FIRST_NAME, LAST_NAME
    FROM TABLE(CAST(V_TEST_COLLECTION AS TEST_ARRAY));
    Exception handler
    END;

  • Can i use create function for MSSql scalar and table valude function.

    Hi,
    1) Can i use create function for MSSql scalar and table valued function?
    2) How many type of user defined function are there in oracle 11g express?
    3) And can i reture any "type" form user defined function?
    yourse sincerely

    944768 wrote:
    Q1)That means even if i return predefined types like integer, varchar2 then also PGA is used ?The data type does not determine where the variable is stored. A string (called a varchar2 in Oracle) can be stored in stack space, heap space, on disk, in a memory mapped file, in a shared memory, in an atom table, etc.
    It is the who and what is defining and using that string, that determines where and how it is stored.
    The Oracle sever supports 2 languages in PL/SQL. The PL (Programming Logic) language is a procedural/declarative language. It is NOT SQL. SQL is integrated with it. The PL/SQL engine uses private process memory (PGA). So PL/SQL variables exist in the PGA (but there are exceptions such as LOBs).
    Q2) So please suggest me solution in oracle.Sounds to me you are looking at how to implement a T-SQL style function as an Oracle function, and once implemented, do joins on the function.
    Do not use PL/SQL in SQL in place of a SQL select. It is not T-SQL.
    One cannot use PL/SQL to create functions along the style of T-SQL, where the function executes a SQL using some conditional logic, and then return as if the function was a native SQL select.
    T-SQL is an extension to the SQL language - making it a hybrid and very impure language implementation. PL is based on ADA - part of the Pascal family of languages. The E-SQL (embedded SQL) approach used in languages like C/C++, Cobol and Ada, has been transparently done in PL/SQL. You can write and mix PL code and variables with SQL code. And the PL/SQL engine figures out how to make the call from the PL/SQL engine to the SQL engine.
    But PL/SQL is not "part" of the SQL language and does not "extend" the SQL language in a T-SQL fashion.
    So you need to check your SQL-Server preconcepts in at the door, as they are not only irrelevant in Oracle, they are WRONG in Oracle.
    The correct way in Oracle, in a nutshell - Use the SQL language to do data processing. Use PL/SQL to manage conditional process flow and the handling of errors.

  • SQL: Issue with running out of storage on server when running table-valued function

    SQL Version: 2008 (not r2)
    Problem:  I'm getting the following error message when running a table-valued function:
    Msg 1105, Level 17, State 2, Line 1
    Could not allocate space for object 'dbo.SORT temporary run storage:  141072001204224' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files
    to the filegroup, or setting autogrowth on for existing files in the filegroup.
    Request:  Could anyone tell me if there are modifications that I could make to my SQL code to avoid this storage issues?
    Thanks,
    ....bob sutor
    Code Facts:
    The JCCD table is a large table 2MM records
    The other tables in the JOINS are very small 15 records or less
    SQL Function Code:
    ALTER FUNCTION [dbo].[xcft_XAWP_GLBalance_JCCD_Detail]()
    RETURNS @JCGLDetail TABLE
          JCCo tinyint
        , Job varchar(10)
        , PostingSource varchar(10)
        , CostToDate numeric(12,2)
        , Phase varchar(20)
        , EarnType smallint
        , LiabilityType smallint
        , CostType tinyint
        , ControllingSetting varchar(30)
        , GLAccountCharged varchar(20)
        , DeptNum varchar(10)
        , DeptDesc varchar(30)
        , JCDC_CostType tinyint
        , CostTypeGL_Open varchar(20)
        , CostTypeGL_Closed varchar(20)
        , JCDO_ExcludePR varchar(1)
        , JCDO_Phase varchar(20)
        , PhaseGL_Open varchar(20)
        , PhaseGL_Closed  varchar(20)
        , JCDL_LiabType smallint
        , LiabTypeGL_Open varchar(20)
        , LiabTypeGL_Closed varchar(20)
        , JCDE_EarnType smallint
        , EarnTypeGL_Open varchar(20)
        , EarnTypeGL_Closed varchar(20)
    AS
    BEGIN
     DECLARE
     @WIPMonthCurrent date
     SET @WIPMonthCurrent = (Select TOP 1 WIPMonth FROM udxcWIPMonths WHERE ActiveWIPPeriod = 'Y')
     INSERT INTO @JCGLDetail
          JCCo
        , Job
        , PostingSource
        , CostToDate
        , Phase
        , EarnType
        , LiabilityType
        , CostType
        , DeptNum
        , DeptDesc
        , JCDC_CostType
        , CostTypeGL_Open
        , CostTypeGL_Closed
        , JCDO_ExcludePR
        , JCDO_Phase
        , PhaseGL_Open
        , PhaseGL_Closed
        , JCDL_LiabType
        , LiabTypeGL_Open
        , LiabTypeGL_Closed
        , JCDE_EarnType
        , EarnTypeGL_Open
        , EarnTypeGL_Closed
     SELECT  
         JCCD.JCCo, JCCD.Job, JCCD.Source, sum(JCCD.ActualCost) AS CostToDate, JCCD.Phase, JCCD.EarnType, JCCD.LiabilityType, JCCD.CostType
       , JCDM.Department, JCDM.Description
       , JCDC.CostType AS JCDC_CostType, JCDC.OpenWIPAcct AS CostTypeGL_Open, JCDC.ClosedExpAcct AS CostTypeGL_Closed
       , JCDO.ExcludePR AS JCDO_ExcludePR, JCDO.Phase AS JCDO_Phase, JCDO.OpenWIPAcct AS PhaseGL_Open, JCDO.ClosedExpAcct AS PhaseGL_Closed
       , JCDL.LiabType AS JCDL_LiabType, JCDL.OpenBurdenAcct AS LiabTypeGL_Open, JCDL.ClosedBurdenAcct AS LiabTypeGL_Closed
       , JCDE.EarnType AS JCDE_EarnType, JCDE.OpenLaborAcct AS EarnTypeGL_Open, JCDE.ClosedLaborAcct AS EarnTypeGL_Closed
     FROM JCCD
     LEFT JOIN JCJP ON JCCD.JCCo = JCJP.JCCo AND JCCD.Job = JCJP.Job
     LEFT JOIN JCCM ON JCJP.JCCo = JCCM.JCCo AND JCJP.Contract = JCCM.Contract
     LEFT JOIN JCDM ON JCCM.JCCo = JCDM.JCCo AND JCCM.Department = JCDM.Department
     LEFT JOIN JCDC ON JCDM.JCCo = JCDC.JCCo AND JCDM.Department = JCDC.Department AND JCCD.CostType = JCDC.CostType
     LEFT JOIN JCDE ON JCDM.JCCo = JCDE.JCCo AND JCDM.Department = JCDE.Department AND JCCD.EarnType = JCDE.EarnType
     LEFT JOIN JCDO ON JCDM.JCCo = JCDO.JCCo AND JCDM.Department = JCDO.Department AND JCCD.Phase = JCDO.Phase
     LEFT JOIN JCDL ON JCDM.JCCo = JCDL.JCCo AND JCDM.Department = JCDL.Department AND JCCD.LiabilityType = JCDL.LiabType
     LEFT JOIN xcft_XAWP_FiscalPeriodCutoffs_ForWIPMonth() AS cutoffs ON JCCD.JCCo = cutoffs.GLCo
     WHERE
          JCCD.Mth <= cutoffs.FiscalYear_LastMonth
         AND JCCD.Job IN(SELECT JobNum FROM budxcWIPData_SQL WHERE WIPMonth = @WIPMonthCurrent)
         AND JCCD.JCCo IN(SELECT JCCo FROM JCCO WHERE udExcludeFromWIP <> 'Y' or udExcludeFromWIP IS NULL)
         --AND LTRIM(RTRIM(JCCD.Job)) = '71-'
     GROUP BY
         JCCD.JCCo, JCCD.Job, JCCD.Source, JCCD.Phase, JCCD.EarnType, JCCD.LiabilityType, JCCD.CostType
       , JCDM.Department, JCDM.Description
       , JCDC.CostType, JCDC.OpenWIPAcct, JCDC.ClosedExpAcct
       , JCDO.ExcludePR, JCDO.Phase, JCDO.OpenWIPAcct, JCDO.ClosedExpAcct
       , JCDL.LiabType, JCDL.OpenBurdenAcct, JCDL.ClosedBurdenAcct
       , JCDE.EarnType, JCDE.OpenLaborAcct, JCDE.ClosedLaborAcct
     UPDATE @JCGLDetail
      SET
          ControllingSetting =
        CASE WHEN Phase = JCDO_Phase AND JCDO_ExcludePR = 'N' THEN 'PhaseOverride-PR Excluded'
          WHEN Phase = JCDO_Phase AND JCDO_ExcludePR = 'Y'
           AND EarnType NOT IN(Select EarnType FROM JCDE WHERE JCDE.JCCo = JCCo AND JCDE.Department = DeptNum)
           AND LiabilityType NOT IN(Select LiabType FROM JCDL WHERE JCDL.JCCo = JCCo AND JCDL.Department = DeptNum)
           THEN 'PhaseOverride-PR Not Excluded'
          WHEN EarnType = JCDE_EarnType THEN 'Earn Type Override'
          WHEN LiabilityType = JCDL_LiabType THEN 'Liability Type Override'
          ELSE 'Cost Type' END
     UPDATE @JCGLDetail
      SET
          GLAccountCharged =
        CASE WHEN ControllingSetting = 'PhaseOverride-PR Excluded' OR ControllingSetting = 'PhaseOverride-PR Not Excluded'
          THEN PhaseGL_Open
          WHEN ControllingSetting = 'Earn Type Override' THEN EarnTypeGL_Open
          WHEN ControllingSetting = 'Liability Type Override' THEN LiabTypeGL_Open
          ELSE CostTypeGL_Open END
    RETURN 
    END
    Bob Sutor

    well, did you either restart the instance or add another tempdb file (no restart required) to let other transactions  continue on the server.
    or check if autogrowth was limited, change that to unlimnited , to the transactions conintue..
    the function may be dumping the data on to tempdb, how much data are you excepting back...what are indexes on the tables
    Hope it Helps!!

  • SQL Server Multiple JOINS with Table Value Function - query never ends

    I have a query with 4 joins using a table value function to get the data and when I execute it the query never ends.
    Issue Details 
    - Table value function 
        CREATE FUNCTION [dbo].[GetIndicator] 
          @indicator varchar(50),
          @refDate datetime
    RETURNS 
    TABLE
    AS
    RETURN
    SELECT
    T1.Id ,T1.ColINT_1, T1.ColNVARCHAR_1 collate DATABASE_DEFAULT as ColNVARCHAR_1 ,T1.ColNVARCHAR_2 ,T1.ColSMALLDATETIME_1, T1.ColDECIMAL_1, T1.ColDECIMAL_1
    FROM TABLE2 T2
    JOIN TABLE3 T3
    ON T2.COLFKT3 = T3.Id
    AND T3.ReferenceDate = @RefDate
    AND T3.State != 'Deleted'
    JOIN TABLE4 T4
    ON T2.COLFKT4 = T4.Id AND T4.Name=@indicator
    JOIN TABLE1 T1
    ON T2.COLFKT1=T1.Id
    - Query
        DECLARE @RefDate datetime
    SET @RefDate = '30 April 2014 23:59:59'
    SELECT DISTINCT OTHERTABLE.Id As Id
    FROM 
    GetIndicator('ID#1_0#INDICATOR_X',@RefDate) AS OTHERTABLE
    JOIN GetIndicator('ID#1_0#INDICATOR_Y',@RefDate) AS YTABLE  
    ON OTHERTABLE.SomeId=YTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=YTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_Z',@RefDate) AS ZTABLE
    ON OTHERTABLE.SomeId=ZTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=ZTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_W',@RefDate) AS WTABLE 
    ON OTHERTABLE.SomeId=WTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=WTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_A',@RefDate) AS ATABLE  
    ON OTHERTABLE.SomeId=ATABLE.SomeId
    AND OTHERTABLE.DateOfEntry=ATABLE.DateOfEntry
    Other details:
    - SQL server version: 2008 R2
    - If I execute the table function code outside the query, with the same args, the execution time is less the 1s.
    - Each table function call return between 250 and 500 rows.

    Hi,
    Calling function in general is a costly query. And definitely joining with a function 5 times in not an efficient one.
    1. You can populate the results for all parameters in a CTE or table variable or temporary table and join (instead of funtion) for different parameters
    2. Looks like you want fetch the IDs falling to different indicators for the same @Refdate. You can try something like this
    WITH CTE
    AS
    SELECT
    T1.Id ,T1.ColINT_1, T1.ColNVARCHAR_1 collate DATABASE_DEFAULT as ColNVARCHAR_1 ,T1.ColNVARCHAR_2 ,T1.ColSMALLDATETIME_1, T1.ColDECIMAL_1, T1.ColDECIMAL_1, T4.Name
    FROM TABLE2 T2
    JOIN TABLE3 T3
    ON T2.COLFKT3 = T3.Id
    AND T3.ReferenceDate = @RefDate
    AND T3.State != 'Deleted'
    JOIN TABLE4 T4
    ON T2.COLFKT4 = T4.Id AND T4.Name=@indicator
    JOIN TABLE1 T1
    ON T2.COLFKT1=T1.Id
    SELECT * FROM CTE WHERE Name = 'ID#1_0#INDICATOR_X' AND Name = 'ID#1_0#INDICATOR_Y' AND Name = 'ID#1_0#INDICATOR_Z' AND Name = 'ID#1_0#INDICATOR_W' AND Name = 'ID#1_0#INDICATOR_A' AND ReferenceDate = @RefDate.
    Or you can even simplify more depends on your requirement.
    Regards,
    Brindha.

  • Problem with tpcall and tpgetrply functions

    Hi,
    I have a problem with tpcall() and tpgetrply() functions.
    In this example (invoke tpcall()):
    FBFR32 *buf;
    FLDLEN32 buflen;
    buf = a_buffer.getBuffer(); /* getBuffer() returns FBFR32* */
    buflen = a_buffer.getLongitud();
    /* at this point: buf == a_buffer.getBuffer() */
    if (tpcall(a_contenedor.getServname(),
    (char*)a_contenedor.getBufferPeticion()->getBuffer(),
    a_contenedor.getBufferPeticion()->getLongitud(),
    (char**)&buf,
    (long*)&buflen,
    0) == -1)
    if (tperrno != TPESVCFAIL)
    LANZAR_EXCEPCION(CADENA_WHAT_SB,
    "Error en funcion Execute(), llamada tpcall()",
    tpstrerror(tperrno))
    /* at this point: buf != a_buffer.getBuffer() */
    tpcall() function change the memory address of buf. What is the problem? Is wrong my code? Is a problem with tuxedo version?
    My tuxedo version is:
    tmadmin -vINFO: BEA Tuxedo, Version 8.0, 32-bit, Patch Level 306
    INFO: Serial #: 650522264137-773290431251, Expiration NONE, Maxusers 150
    INFO: Licensed to: Telefonica Moviles Espa?a, S.A.
    INFO: 56-bit Encryption Package
    Thanks,
    ANTONIO.

    There's nothing wrong with your code or tuxedo. tpcall (and tpgetrply) can change the address of the return buffer if it needs to allocate more memory to hold the data. This is the reason why you pass a pointer to the buffer as the output buffer parameter to tpcall and tpreturn. Everything is working as expected.

  • Chart - problem with realize one of the function under CR XI

    Post Author: mrowa
    CA Forum: Charts and Graphs
    Hello,
    I have
    problem with realize one of the function under CR XI. I would be persuade if
    any of us would like to help me.
    1)   
    1) From
    database (basically from one table), I take data to make report. Each of record
    have appropriate fields:
    dteData
    intYear
    intMonth
    intDate
    2)   
    2) I
    want to realized comparison data from two or more periods of time on one chart
    and in one table. For easily explanation I will describe problem on two
    periods.For instance, user want to display and compare
    on chart date (type monthly -sum data of each month) from 2007.02 u2013 2007.05
    with date from 2006.03 u2013 2006.06. So we compare month 2007.02 with 2006.03;
    2007.03 with 2006.04; 2007.04 with 2006.05; 2007.05 with 2006.06
    On char I would like to display bars with comparison
    of months.
    Problem is that I donu2019t know how to write
    something similar. I can use one period without any problems, but two and mores
    I canu2019t realized.
    Detail description:
    I passed
    two parameters two report:
    {?from}, {?to} u2013for first period
    {?offset}, it means {?from}+{?offset},
    {?to}+{?offset}  - for second period
    On axis Y I have Sum(intDate);On
    X (year + month). But on each value x( example 20007.02) I need to have
    two values (bars). Value for standard period and offset.
    For example for x=2007.02, I need
    two bars one equal 2007.02 and second with offset u2013 2006.03
    Movement to next value (bar) is
    persuade by fields {data.rok}&{data.month} first or second period. This is
    combination of two elements year&month defined under Formula. Problem
    persist in that both period has different year.month and here problem starts once
    again. I donu2019t know how to solve it. I have found out one solution but it
    limits user only for two periods (I want to compare more).
    My idea for compare only two
    periods:
    I make one query in CR for one
    period and second query for second period.
    Firs query:
    "SELECT 
           year ,
          month
    Second query
    "SELECT 
           year + FLOOR({month + offset} % 13),
          {month + offset} % 13
    Then in CR I connect two periods and
    make u201Ctableu201D (results of queries) with JOIN on fields year and month.
    This solution is not functional,
    because I need to make reports for days and hours as well. In this solution I
    canu2019t use (%31), because not all months has 31 days.
    I use CR in WEB app made in Visual
    Studio 2005. Maybe from aspx we can manipulate with date to get exact solution,
    and solve problem with SELECT.
    Hope my description clearly
    describe problem and someone will be able to help me. I would be thankful.

    I have had similar problem before.
    Because I had too many data, the legend would not display all the data. Also the chart would not display all the data. But I was able to find a work around.
    In your case, Right click on the Legend text and click on Format Legend Entry.
    Change the font of the legend to 4 (which is the minimum). This may work.
    If you are also having problem with data labels, you could change the font size of the data labels.
    Hope this helps.
    Thank you.

Maybe you are looking for