Month returning no records ...

Hi All,
I am having a bit issues here. I have created a view V_TEST on a table containing the columns -
COUNT_ID NUMBER(10,0) No
LOC_ID NUMBER(10,0) Yes
VEHICLE_CLASS NUMBER(6,0) Yes
RECORD_DATE DATE Yes
RECORD_MONTH VARCHAR2(9) Yes
RECORD_YEAR VARCHAR2(4) Yes
FINANCIAL_YEAR VARCHAR2(100) Yes
RECORD_TIME VARCHAR2(40) Yes
UPLOAD_DATE DATE Yes
UPLOADED_BY VARCHAR2(50) Yes
Here I have customised the record_month from record_date column using to_char(record_date,'Month') as RECORD_MONTH and it is storing all the valid month data like January, February, March and so on.
Sample data like this -
<!--[if gte mso 9]><xml>
Normal
0
false
false
false
MicrosoftInternetExplorer4
</xml><![endif]--><!--[if gte mso 9]><xml>
</xml><![endif]-->
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}
</style>
<![endif]-->
COUNT_ID LOC_ID VEHICLE_CLASS RECORD_DATE RECORD_MONTH
1186 3064 1 16/FEB/06
February
1187 3064 4 14/FEB/06
February
1188 3064 5 12/FEB/06
February
1189 3064 1 22/SEP/08
September
1190 3064 4 09/AUG/07
August
1191 3064 2 22/JUN/08
June
1192 3064 2 22/JUN/08
June
1193 3064 1 22/JUN/08
June
1194 3064 3 22/JUN/08
June
1195 3064 3 22/JUN/08
June
Now in my report (based on the this view) I want to sort data by selecting month from a drop down box. Say if user select 'January' it should display only the result for January month. But it shows 'No data found'. I can not figure it out, my sql query is as below -
SELECT l.name, m.loc_id "Location", to_char(m.record_date,'Month'), m.Record_month,
m.financial_year, m.vehicle_class, initcap(m.uploaded_by), m.upload_date
from rtv_metro_count m, rtt_locations l
where l.loc_id=m.loc_id
and m.record_month = :input;
I also have tried this m.record_month=to_date(:input,'Month') but the same issue no data found.
Can anybody help me with this please,
Advanced thanks,
M Tajuddin

Karthick_Arp wrote:
did you runt he SQL given by me. i have removed your month condition. just run it and show us the output. i want to see the values in record_month column.Yes I did it works fine and out put below -
Output:
NAME Location TO_CHAR(M.RECORD_DATE,'MONTH') RECORD_MONTH FINANCIAL_YEAR VEHICLE_CLASS INITCAP(M.UPLOADED_BY) UPLOAD_DATE
SHELLEY BEACH 3064 February February 2007-2008 1 Demo 04/SEP/08
SHELLEY BEACH 3064 February February 2007-2008 4 Demo 04/SEP/08
SHELLEY BEACH 3064 February February 2007-2008 5 Demo 04/SEP/08
SHELLEY BEACH 3064 September September 2007-2008 1 Demo 04/SEP/08
SHELLEY BEACH 3064 August August 2007-2008 4 Demo 04/SEP/08
SHELLEY BEACH 3064 June June 2007-2008 2 Demo 04/SEP/08
Thanks,
Tajuddin

Similar Messages

  • Returning only records that have no entry in a specific field

    Hello,
    I'm new to this forum and relatively new to Crystal Reports, so I apologize if this information is "plain as day" somewhere.  I've been hunting for this info for quite a while and can't find anything that makes sense!
    I am trying to put together a very simple report that will return only records where a certain field is blank.
    It is an Access database, in an information management program specific to our type of business.  CR 11 software was included with the LIMS (Laboratory Information Management System), as the reports generated from the LIMS software are in CR.  I've learned enough to be able to tweak reports and make some basic reports, but I can't find a simple answer to what I think is a simple question! 
    I have the report set up to access the following fields in the database:  Invoice number, Client name, Due date, Invoice amount, and Payment Received.  This will be used as a "cross check" - not as any major accounting tool - as the Payment Received field is simply the date that the payment was received.  If no payment has been received, the field is left blank.
    I want the report to return ONLY those records where that field is blank (i. e. a list of invoices/clients whose payment has not yet been received).
    Ideally, I would also like to be able to return only those records where that field is blank OR within a certain date range (i. e. less than 30 days from the date that the report is run).  However, we'll probably only use this report a couple of times a month, so that is not as critical.
    I know I need to filter the records according to the Payment Received field, but don't know how to construct a formula that says "just show the fields where there is nothing entered."
    Thank you!
    Brenda

    This is the hardest function to find:  IsNull
    If isNull(field) then  
        //  if the above fails on a numberic field or text field then see the following two-some databases are picky.
    If IsNull(field) or field=0 then  //this one maybe needed for a numeric field
    If IsNull(field) or field=""    //  this one maybe needed for a text field
    if IsNull(field) or field=<value>
    or
    if IsNull(field) or field like <value*>
    You always want the IsNull statement to be the first statement, and it is especially usefull when testing for not equal
    If IsNull(field) or field <>  <value>

  • CIS monthly returns (CIS300)

    A problem with the Generic Withholding Tax Report transaction S_P00_07000134, program RFIDYYWT.
    The 2007 online filing of CIS monthly returns (CIS300) has been set up and is working, but when running the report an additional parameters pop up window asks "Nil Returns" y/n. If you select yes the following message is displayed
    You have selected Nil Return.
    This will remove all Sub-contractor records, even if they exist!
    Is this OK?
    I cannot find any information in SAP explaining what this does and why it is required. Any assistance is appreciated.

    My guess is that this will complete and produce a nil return - but it does this by removing any items that should be on the return...hence the warning.
    I'd guess you shouldn't use this option unless you are sure that you do not have any items and therefore need to produce a nil return!
    Hope this helps
    Bernie

  • Online filing of CIS Monthly Returns (CIS300)

    A problem with the Generic Withholding Tax Report transaction S_P00_07000134, program RFIDYYWT.
    The 2007 online filing of CIS monthly returns (CIS300) has been set up and is working, but when running the report an additional parameters pop up window asks "Nil Returns" y/n. If you select yes the following message is displayed
    You have selected Nil Return.
    This will remove all Sub-contractor records, even if they exist!
    Is this OK?
    I cannot find any information in SAP explaining what this does and why it is required. Any assistance is appreciated.

    My guess is that this will complete and produce a nil return - but it does this by removing any items that should be on the return...hence the warning.
    I'd guess you shouldn't use this option unless you are sure that you do not have any items and therefore need to produce a nil return!
    Hope this helps
    Bernie

  • Mac mail search function is not working. Any search term returns all records.

    Mac mail search function is not working. Any search term returns all records.

    hi eric. many thanks.
    i will have to read these links closer but what i meant to say is that the hard drive space that was being taken up seemed like it suddenly jumped way up because i had just gotten through a process in the last month where i am storing all my My Documents data on my Mac Pro. i am doing this in order to decide whether i should just keep it ALL on my Mac Pro and use ChronoSync to sync /some/ of it to my MBP.
    so if i look in the Documents folder on my Mac Pro i have a ton of folders that i have created with a ton of data. if i look in the Documents folder on my MBP there are NO folders that have data in them that i created. there are other folders such as folders that various software created but what i mean to point out is that there was a LOT of available space on my HD until recently.
    i am wondering if there is some way that running the Mail re-index (it then ran some kind of "Importing" routine) or by syncing my Photostream to the MBP caused a huge jump in data on this drive. if it is the photostream sync i can just take this off or see if it will sync more selectively. if it is something to do with mac mail jumping in size i am not sure why this would happen or what to do about it.
    does that question make sense?
    i mean, before i did these two operations my recollection is that i would have had 130 GB on the hard drive (really just guessing here) and now there is like 218 GB on the hard drive and i don't know where all this came from...

  • How to display empty months when grouping records by month

    Guys, I've got a recordset that successfully displays all
    records in the
    table grouped according to the month that the record was
    created in.
    This allows me to display a Monthly tally (a bit like a
    barchart - where the
    height of the column is derived by the qty of records for
    that given month)
    for each of the months in the year so far. However, it dawned
    on me today
    that if there was no activity in a given month, the month
    simply doesn't
    appear at all, rather than displaying but showing "0" as I
    would prefer.
    For example, the type of thing I want to display onscreen is:
    Month 1 2 3 4 5 6 7 8 9 10 11 12
    But let's say there were no records inserted in months June
    to September
    (inclusive), what I'm actually getting onscreen is:
    Month 1 2 3 4 5 10 11 12
    But what I actually want to appear onscreen is:
    Month 1 2 3 4 5 6 7 8 9 10 11 12
    I hope that makes some kind of sense...
    I'm using Dreamweaver CS3, ASP/VBScript, and MySQL.
    My current SQL Statement is as follows:
    SELECT Count(AffiliateID) AS TotalClicks, MONTH(`VisitDate`)
    AS Month
    FROM tbl_affiliaterefferals
    WHERE `AffiliateID` = "49" AND YEAR(`VisitDate`) =
    YEAR(Now()) GROUP BY
    MONTH(`VisitDate`)
    ORDER BY MONTH(`VisitDate`) ASC
    I figured one workaround would be to have 12 separate
    recordsets - one for
    each month - on the one page, but there must be a cleaner way
    of doing it
    surely?
    Any/all help greatly appreciated.
    Regards
    David

    This is a multi-part message in MIME format.
    ------=_NextPart_000_0086_01C932EC.D9CE33D0
    Content-Type: text/plain;
    format=flowed;
    charset="iso-8859-1";
    reply-type=original
    Content-Transfer-Encoding: 7bit
    Hi Joe,
    I've simply got a table, within one cell of which is another
    table to which
    I've applied a background colour and am specifying the height
    of the <td>
    cell as the qty of the number of records returned for Month 1
    of the current
    year. Then I'm applying a repeat region to the <TD>
    cell containing the
    table that varies in height, in order to force the table to
    repeat
    horizontally according to the number of records (months)
    retrieved from the
    database.
    The code for the table is in the attached txt file.
    I appreciate your time in responding however you must have
    missed my
    comments about what I'm working in as I'm working in
    ASP/VBScript and
    haven't the first clue when it comes to PHP.
    I don't suppose you know or can point me in the direction of
    an ASP
    equivalent of your suggestion?
    Regards
    David
    "Joe Makowiec" <[email protected]> wrote in
    message
    news:[email protected]...
    > On 20 Oct 2008 in macromedia.dreamweaver, DTB-K wrote:
    >
    >> I figured one workaround would be to have 12
    separate recordsets -
    >> one for each month - on the one page, but there must
    be a cleaner
    >> way of doing it surely?
    >
    > Without seeing the code you're using to display it...
    >
    > Probably what that code is doing is looping through the
    recordset:
    >
    > <?php do { ?>
    > ...
    > <?php } while ($row_dates =
    mysql_fetch_assoc($dates)); ?>
    >
    > That's DW's standard PHP MySQL recordset behavior. What
    you want to do
    > is something more like:
    >
    > <?php
    > for ($i=1;$i<13;$i++) { // Do 12 months
    > echo '<p>Month: ';
    > echo $i; //Echo the month
    > if ($row_Recordset1['Month'] == $i) {
    > // Have data for this month
    > echo ' Clicks: ';
    > echo $row_Recordset1['TotalClicks'];
    > // Now get the next row
    > // Note that we only want to get the next row if the
    current month
    > // has data. That's why the fetch command is inside the
    if.
    > $row_Recordset1= mysql_fetch_assoc($Recordset1);
    > } // End if
    > echo "</p>\n";
    > } // End for
    > ?>
    >
    > --
    > Joe Makowiec
    >
    http://makowiec.net/
    > Email:
    http://makowiec.net/contact.php
    ------=_NextPart_000_0086_01C932EC.D9CE33D0
    Content-Type: text/plain;
    format=flowed;
    name="Code.txt";
    reply-type=original
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: attachment;
    filename="Code.txt"
    <table border=3D"0" cellpadding=3D"0"
    cellspacing=3D"0">
    <tr>
    <td colspan=3D"2" valign=3D"bottom"><h1>Current
    Year:</h1></td>
    </tr>
    <tr>
    <td valign=3D"bottom" =
    class=3D"BodyTxtsml"><strong>Month</strong></td>
    <%=20
    While ((Repeat1__numRows <> 0) AND (NOT
    Rs_MonthlyClicks.EOF))=20
    %>
    <%Dim TotalClicks, Cellheight
    TotalClicks =3D =
    FormatNumber((Rs_MonthlyClicks.Fields.Item("TotalClicks").Value),
    0, -2, =
    -2, -2)
    Cellheight =3D (TotalClicks)
    %> =20
    <td valign=3D"bottom" class=3D"BodyTxtsml" =
    title=3D"<%=3D(TotalClicks)%>"><div
    align=3D"center"><table border=3D"0" =
    cellspacing=3D"0" cellpadding=3D"0">
    <tr>
    <td height=3D"<%=3D(Cellheight)%>" =
    bgcolor=3D"#003366" onMouseOver=3D"this.bgColor =3D
    '#FFDB9D'" =
    onMouseOut=3D"this.bgColor =3D'#003366'"
    width=3D"40"> </td>
    </tr>
    =
    </table><%=3D(Rs_MonthlyClicks.Fields.Item("Month").Value)%></div></td>
    <%=20
    Repeat1__index=3DRepeat1__index+1
    Repeat1__numRows=3DRepeat1__numRows-1
    Rs_MonthlyClicks.MoveNext()
    Wend
    %> =20
    </tr>
    </table>
    ------=_NextPart_000_0086_01C932EC.D9CE33D0--

  • Parameter Field Value returns "no records"

    I am using Crystal 11 and am new to Crystal but not to other Reportwriters.  I have a Crystal report that has 2 parameter fields, one is "Enter Date" that prompts for the start and end date, the other "Select Items" prompts for the supply Item Numbers to be included in the report.  In the "Edit Parameter: Select Items:" edit/create parameter dialog, the Select Item parameter has "Allow Multiple values" and "Allow discrete values" set to true. The report runs fine and returns any items entered in the "Select Items" prompt that has usage during the start & end date.  My problem is ... if the entered Item Number for the Select Items parameter returns no records, I cannot report that Item Number as having zero usage.  I cannot find a way at the time of report running to identify and report the "not found" items.  I would also like to report the Start and End Dates parameters requested, but cannot, the Enter Date parameter returns an empty parameter field across the whole report.  I'm sure other users have had this problem of reporting the requested parameter values.   Need assistance.  

    Jeff's answer is one way to do it.  There are others:
    If you want the items with no data interspersed with the other items (say, in item number order), then you'd change the report to use your item master table and do a left join from that to the usage data.  If a field from the usage table is null, then there was no usage, and you can condition a message based on that.
    Or, if your parameter selects item numbers without some type of "ALL" option, then you can use arrays to keep track of which if the selected items printed.  Then in the report footer, compare the list of items reported to the parameter items, and show which item numbers had no usage.  (This might run a tad faster than the separate subreport that Jeff suggested - but maybe not...)
    HTH,
    Carl

  • Global Temp Table, always return  zero records

    I call the procedure which uses glbal temp Table, after executing the Proc which populates the Global temp table, i then run select query retrieve the result, but it alway return zero record. I am using transaction in order to avoid deletion of records in global temp table.
    whereas if i do the same thing in SQL navigator, it works
    Cn.ConnectionString = Constr
    Cn.Open()
    If FGC Is Nothing Then
    Multiple = True
    'Search by desc
    'packaging.pkg_msds.processavfg(null, ActiveInActive, BrandCode, Desc, Itemtype)
    SQL = "BEGIN packaging.pkg_msds.processavfg(null,'" & _
    ActiveInActive & "','" & _
    BrandCode & "','" & _
    Desc & "','" & _
    Itemtype & "'); end;"
    'Here it will return multiple FGC
    'need to combine them
    Else
    'search by FGC
    SQL = "BEGIN packaging.pkg_msds.processavfg('" & FGC & "','" & _
    ActiveInActive & "','" & _
    BrandCode & "',null,null); end;"
    'will alway return one FGC
    End If
    ' SQL = " DECLARE BEGIN rguo.pkg_msds.processAvedaFG('" & FGC & "'); end;"
    Stepp = 1
    Cmd.Connection = Cn
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Dim Trans As System.Data.OracleClient.OracleTransaction
    Trans = Cn.BeginTransaction()
    Cmd.Transaction = Trans
    Dim Cnt As Integer
    Cnt = Cmd.ExecuteNonQuery
    'SQL = "SELECT rguo.pkg_msds.getPDSFGMass FROM dual"
    SQL = "select * from packaging.aveda_mass_XML"
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Adp.SelectCommand = Cmd
    Stepp = 2
    Adp.Fill(Ds)
    If Ds.Tables(0).Rows.Count = 0 Then
    blError = True
    BlComposeXml = True
    Throw New Exception("No Record found for FGC(Finished Good Code=)" & FGC)
    End If
    'First Row, First Column contains Data as XML
    Stepp = 0
    Trans.Commit()

    Hi,
    This forum is for Oracle's Data Provider and you're using Microsoft's, but I was curious so I went ahead and tried it. It works fine for me. Here's the complete code I used, could you point out what are you doing differently?
    Cheers,
    Greg
    create global temporary table abc_tab(col1 varchar2(10));
    create or replace procedure ins_abc_tab(v1 varchar2) as
    begin
    insert into abc_tab values(v1);
    end;
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
        static void Main(string[] args)
            OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger");
            con.Open();
            OracleTransaction txn = con.BeginTransaction();
            OracleCommand cmd = new OracleCommand("begin ins_abc_tab('foo');end;", con);
            cmd.Transaction = txn;
            cmd.ExecuteNonQuery();
            cmd.CommandText = "select * from abc_tab";
            OracleDataAdapter da = new OracleDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Console.WriteLine("rows found: {0}", ds.Tables[0].Rows.Count);
            // commit, cleanup, etc ommitted for clarity
    }

  • SQL Command returns multiple records, but I see only one record in report

    I work with Crystal Reports XI R2 SP3 and Oracle 10g R2 database.
    I have an SQL Command that returns multiple records. Command name is "CommDivisionNames" and it returns column "CommDivisionNames.DIVISION_NAME". When I place this field into report details section of the report, I can see all 10 records returned and this is how it should be. I actually need this field to be placed in the report header section, and when I place the field there, then I see only the first record. I set that field as "can grow = true". When I do "browse field data" for this field, I see that all 10 records are there, but only the first one is displayed in report header section.
    I thought that I can place SQL Command field anywhere on the report (page header, footer, details) and that it will always show all records that it returns from the database. Can that be done?
    My "main part" of the report returns different set of records, and that's what I have in "report details" section. I need this list of divisions to be in the report header section, so user can see that the report was executed for DivA, DivC, DivE.
    Thank you,
    Milan

    sharonamt:
    Users select divisions from parameter, but the parameter multi values are division_numbers (1,5,10), not division_names. Division_names are visible in parameter_prompt_window as description, but parameter remembers only numbers and I don't know how I can reuse division_names later in formula.
    I do join for division_numbers and make them into one string variable and pass to sub-report, but I think that I can only get these division_names by calling an SQL command or calling stored procedure.
    If I try to do join({MySQLcommand.DIVISION_NAME}) I get error message "A string array is required here".
    Carl:
    I'm playing with cross-tab and I can use it to see all division_names in the report-header section. Since I need them in only one column or only one row, I have to edit cross-tab object and turn all unneeded border lines to white to make them look invisible. So, cross-tab could be a solution for my problem here.
    Another option could be to re-write my SQL command. Since I've read here that SQL command could be written in the same way as I would write a stored procedure, then I could use a bit more complex code to get all multiple division names from the database table into a local cursor, and then use do-while loop to concatenate them into one string, and then to return that string as one record (like 'DivA, DivB, DivC'), and then it should not be a problem to display only that one record/string in report header. It is my understanding that Crystal Reports can call stored procedure that works with many cursors/recordsets and CR will use only the last recordset from the stored procedure. Do you think it could be done this way?
    Thank you,
    Milan

  • Query returns zero records in coldfusion context, but works fine in Navicat

    I've got a query that's returning zero records when I load a page.  If I copy and paste that same query (from the debug output) into navicat, I get rows returned (as I expect).  Has anyone seen this?  It happens locally (CF9) AND remotely on our staging server (CF10).  Even weirder, it's a query that was previously working fine - I simply added an if statement to the where clause, and all of a sudden... 
    Here's the query:
            <CFQUERY name="LOCAL.getEncounterServices" datasource="#REQUEST.dsn#"> 
            SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
              <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
               </CFIF>
                AND c.LocationID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.locationID#">
                AND c.CustomerID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.customerID#">
            </CFQUERY>
    All of this worked just fine before I added the lines:
             <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
              </CFIF>
    Previously, it had just been:
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
    With no IF/ELSE statement.
    Anyone seen anything like this before?  Any ideas? 
    Thanks.

    Right, I'll start disabusing myself of the DateFormat!
    I'm sorry, I should've posted the actual query too.  It's inserting the first part - "AND c.EncounterID = ....."
    Here's the full query:
    LOCAL.getEncounterServices (Datasource=xmddevdb, Time=9ms, Records=0) in /Applications/ColdFusion9/wwwroot/XMD_NEW/xmd_dev/cfc/ShoppingGateway.cfc @ 16:56:28.028
    SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
                     AND c.EncounterID = ?
                AND c.LocationID = ?
                AND c.CustomerID = ?
    Query Parameter Value(s) -
    Parameter #1(cf_sql_integer) = 28
    Parameter #2(cf_sql_integer) = 16
    Parameter #3(cf_sql_integer) = 6
    Thansk again for the help!

  • 0fi_ar_4 INIT returning zero records

    Hi gurus,
    0fi_ar_4 INIT is returning zero records while loading into ODS.I have checked in RSA3 it is returning zero records with INIT selection but is it is fetching records with Full update.Can ne one tell me what to do.how to solve this problem.
    rgds,
    ***Points Assured**

    Hi Suravi,
    Check at the Info Package selection-- Init with out data transfer.
    Make it with data transfer..
    Hope it helps..

  • How to execute an Oracle stored procedure which returns many records?

    I have two synchronous scenarios XI<->PI<->JDBC, where JDBC is receiver adapter.
    Each scenario runs a different stored procedure in Oracle database.
    The first stored procedure returns only one record, the second stored procedure returns many records, which come from a cursor.
    In the first scenario I executed the stored procedure following the directions of Help SAP page and works perfectly.
    Link: [http://help.sap.com/saphelp_nw70/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm]
    <root>
      <StatementName5>
        <storedProcedureName action=u201DEXECUTEu201D>
          <table>realStoredProcedureName</table>
          <param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
        </storedProcedureName>
      </StatementName5>
    <root>
    I have sought in the forums of SDN and cannot find the way to run the second stored procedure, and receive the information it returns.
    Thank you for your help.
    Rafael Rojas.

    Think It doesnt matter either cursor or result set. Try to get the response back from JDBC and see what are the fields it exactly populating.
    In Procedure you can able to find the columns selecting in Cursors. Give those columns in the DT.
    File - JDBC (Execute-- Procedure)
    To get the response
    JDBC_respose -  File
    Correct me if im wrong.
    Regards
    Ramg

  • Stored procedure returning multiple records without using SYS_REFCURSOR

    Hello,
    I am new to oracle stored procedures, have done stored procs in SQL server in past. I am trying to write single stored proc which will return multiple records. I have the stored proc as below and that is compiled without any errors.
    We don't want to use SYS_REFCURSOR as output param b'coz the place from which this proc is gonna call, that system doesn't support SYS_REFCURSOR param.
    create or replace
    PROCEDURE p_get5500DATA_MB (
    IN_plan_ID IN T_5500DATA_QWP.Plan_ID%TYPE,
    IN_plan_ID_col OUT T_5500DATA_QWP.Plan_ID%TYPE,
    p_SEQNUM OUT T_5500DATA_QWP.SEQNUM%TYPE,
    p_HEADER_CD OUT T_5500DATA_QWP.HEADER_CD%TYPE,
    p_VALUE1 OUT T_5500DATA_QWP.VALUE1%TYPE,
    p_VALUE2 OUT T_5500DATA_QWP.VALUE2%TYPE
    ) AS
    BEGIN
    SELECT
    Plan_ID,
    SEQNUM,
    HEADER_CD,
    VALUE1,
    VALUE2
    INTO
    IN_plan_ID_col,
    p_SEQNUM,
    p_HEADER_CD,
    p_VALUE1,
    p_VALUE2
    FROM TRS1DBO.T_5500DATA_QWP
    WHERE Plan_ID = IN_plan_ID
    ORDER BY SeqNum;
    -- EXCEPTION
    -- WHEN OTHERS THEN
    -- RAISE_APPLICATION_ERROR(-210001, 'Error in fetching data from T_5500DATA_QWP....');
    END;
    Error:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at "TRS1DBO.P_GET5500DATA_MB", line 10
    ORA-06512: at line 11
    My questions is:
    - What would be the best practice for this type of simple stored procedures?
    - Is there any alternate or is there anything i can fix in above stored proc which return multiple records?
    Thank you,
    Vimal

    Just out of curiosity, what are you using for API or driver that doesn't support a ref cursor? Ref cursors are pretty much the defacto standard for passing multiple records out of an Oracle procedure. Oracle's ODP.NET, OLEDB, ODBC, JDBC, OCI, all support ref cursors. Chances are that if the driver you're using doesn't support something as basic/fundamental as a ref cursor, it's probably also not going to support something else either.
    You'll most likely want to check with the driver/api vendor on their recommended approach.

  • Using index in a query return few records than full table access

    Today we have an issue with a query, when it use the ok index the returned are not all records that apply to where clause condition.
    See bellow
    explain plan for
    select * from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 136999
    SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1882720105
    | Id | Operation | Name |
    | 0 | SELECT STATEMENT | |
    | 1 | TABLE ACCESS BY INDEX ROWID| ZAN_M03 |
    |* 2 | INDEX RANGE SCAN | PK_ZAN_M03 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    2 - access("M00AF"=TO_DATE('11/01/28','YY/MM/DD') AND "M00ZA"=10 AND
    "M00AC"=50 AND "M00AD">=136906 AND "M00AD"<=137141)
    filter("M00AD"<=137141 AND "M00AD">=136906)
    Note
    - rule based optimizer used (consider using cbo)
    20 rows selected.
    The query above return only one row insted 1579 record that apply to this conditions.
    When forcing a full table acess with a hint, the query return all records that apply, the 1579 record.
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    Can you help me to identify what's happening?
    I am with Oracle 10g R2 10.2.0.4 standard edition
    the statistics are up to date
    the opitimizer_mode are rule, but altering in session level to all_rows happens the same issue.
    Nothing about corruption in the alert log.
    Thanks in advance
    Regards
    Cristiano

    Yes the query are the same and correct restriction for where clause are M00AD between 136906 and 137141.
    I've pasted, by mistake, another test query
    The corrects are:
    select M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This use pk index and return one row
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This does a full table access and return 1579 records
    I´ve been searching for wrong results bugs on my oracle support, but not found one that mentions something like our issue.
    I checked the dba_tables and dba indexes and the number of rows are different, and I think this would be the same because it's is a pk.
    Look this
    SQL> select NUM_ROWS from dba_tables where table_name = 'ZAN_M03'
    2 /
    NUM_ROWS
    228527878
    select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    SQL> select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    NUM_ROWS
    217510185
    Is normal a index for pk having much fewer rows than table? I think not, but not sure.
    Again
    Thanks in advance
    Regards
    Cristiano

  • Calling a function from SQL prompt that returns a record

    Hi,
    I've been trying to execute a function that is present on a different database. for eg. I am loged on to a database say 'A' and trying to execute a function present in database 'B'. this function is present in a package 'X' which has 2 functions and two procedures. From the packages i am able to execute the two procedures and one of the function.
    So i guess it is not a problem with the access permissions. The function that i am trying to call say function I has got 3 OUT
    parameters and 1 IN parameter. the Function returns a record. When i try to execute this function i get an error. Can you please let me know as to how exactly i need to call this function from the SQL prompt...
    thanx in advance
    null

    Hi Anand,
    As your function has 3 OUT parameters and it returns a record you can not just call it from SQL Plus. You need to write small PL/SQL program and use variables to hold the OUT values and the returned record.
    Good Luck,
    RajKiran
    null

Maybe you are looking for