How to replace EQUAL TO by LIKE in a Query involving variables

Dear All,
I am working on a Query which is in reality 3 Queries in 1. It works perfectly.
When I run the Query, it gives the following Query - Selection Criteria
Query - Selection Criteria
Import Log                        ...................
Block Number                      ...................
Document Date                     ...................
Document Date                     ...................
[OK]   [Cancel]
To use this Query, we must choose only 1 criterion and leave other fields blank. To achieve this, I
use OR inside WHERE
1ST Query
If you type S713 in the first field, it returns all records with Import Log = S713
2 ND Query
If you type G1575 in the 2ND field, it returns all records with Block Number = G1575
3rd  Query
If you type '01.07.11' and '05.07.11' in the 3RD and 4TH fieldS, it returns all records with
Dates between 01.07.00 and 05.07.11
The Query won't work if you fill in all fields.
WHAT I WANT?
I want to replace the EQUAL TO in the WHERE clause by LIKE to allow the Query to search for a pattern, instead
of rendering an exact match.
I know this can be done with  = '[%1]' by changing it to LIKE '%[%1]%'
But how can you do the same with @shipnum and @reqnum?
I can change the variable declarations to
set @shipnum = /*   */ '%[%1]%'
but it creates problems.
How can we use LIKE in the WHERE clause, without modifying the declarations.
Thanks
Leon Lai
Here's my Query
TABLES:
T0 = OPCH A/P Invoice - Header
T1 = PCH1 A/P Invoice - Rows
T5 = OJDT Journal Entry
declare @shipnum nvarchar (30)
set @shipnum =
/*select T1.[ImportLog] from [dbo].[PCH1] T1 where T1.[ImportLog]*/ '[%1]'
declare @reqnum nvarchar (30)
set @reqnum =
/*select T1.[BlockNum] from [dbo].[PCH1] T1 where T1.[BlockNum]*/ '[%2]'
declare @taxdt1 datetime
set @taxdt1=
/*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%3]'
declare @taxdt2 datetime
set @taxdt2=
/*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%4]'
SELECT
T0.[TaxDate] AS 'Doc Dt',
T1.[ImportLog] AS 'Ship #',
T1.[BlockNum] AS 'Reqn #',
T0.[CardName] AS 'Supplier Name',
T0.[DocTotal] AS 'Rs'
FROM [dbo].[OPCH] T0
INNER JOIN [dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID] = T5.[TransID]
WHERE
(T1.[ImportLog]  = @shipnum  AND
@reqnum = '  ' AND
@taxdt1  = '  ' AND
@taxdt2  = '  ' )
OR
(T1.[BlockNum] = @reqnum  AND
@shipnum = '  ' AND
@taxdt1  = '  ' AND
@taxdt2  = '  ' )
OR
(T0.[TaxDate] >= @taxdt1 AND
T0.[TaxDate] <= @taxdt2 AND
@shipnum = ' ' AND
@reqnum = ' ' )

Dear Gordon,
Thanks for your reply.
Unfortunately it does not work when I use
T1.[ImportLog]  LIKE '%@shipnum%'
I think I could guess the reason:
Since @shipnum means '% { %1 } %'             
/* I use { } to represent Square Brackets */
Then
LIKE '%@shipnum%'  would mean
LIKE '% '%{%1}%'    '
and this would be incorrect syntax.
If I remove the ' it still does not work.
By numerous trial and error, I just arrived at  this mixture of @variable and '{%x}' which works!
I have no idea why, and it appears rather messy.But it works seamlessly.
I tried using uniquely {%x} without the @variables. It does not work.
So, if you could analyse it and put it in neater form (I mean without a mixture of @ and { },
I would be grateful.
There are so many tricks I used to make my Queries work, without understanding
at all why they work.
Best Regards,
Leon Lai
TABLES:
T0 = OPCH A/P Invoice - Header
T1 = PCH1 A/P Invoice - Rows
T5 = OJDT Journal Entry
declare @shipnum nvarchar (30)
set @shipnum =
/*select T1.[ImportLog] from [dbo].[PCH1] T1 where T1.[ImportLog]*/ '%[%1]%'
declare @reqnum nvarchar (30)
set @reqnum =
/*select T1.[BlockNum] from [dbo].[PCH1] T1 where T1.[BlockNum]*/ '%[%2]%'
declare @taxdt1 datetime
set @taxdt1=
/*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%3]'
declare @taxdt2 datetime
set @taxdt2=
/*select T0.[TaxDate] from [dbo].[OPCH] T0 where T0.[TaxDate]*/ '[%4]'
SELECT
T0.[TaxDate] AS 'Doc Dt',
T1.[ImportLog] AS 'Ship #',
T1.[BlockNum] AS 'Reqn #',
T0.[CardName] AS 'Supplier Name',
T0.[DocTotal] AS 'Rs'
FROM [dbo].[OPCH] T0
INNER JOIN [dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID] = T5.[TransID]
WHERE
(T1.[ImportLog]  like @shipnum  AND
'[%2]'  = '  '  AND
@taxdt1  = '  ' AND
@taxdt2  = '  ' )
OR
(T1.[BlockNum] like @reqnum  AND
'[%1]' = '  ' AND
@taxdt1  = '  ' AND
@taxdt2  = '  ' )
OR
(T0.[TaxDate] >= @taxdt1 AND
T0.[TaxDate] <= @taxdt2 AND
'[%1]' = ' ' AND
'[%2]'= ' ' )

Similar Messages

  • How to replace automatically 'blank' values by '#' in Input Query ?

    Hi there,
    the Command REFRESH_COMMAND triggers an error message if the field is blank. Is there a way with a Java Script to browse the ANALYSIS_ITEM and replace with # all blank values ?
    Is there a way to debbug REFRESH_DATA since the error message is triggered in the Java Stack ?
    Otherwise can someone let me know how to browse the content of the InputQuery ?
    I managed to write some Java to replace blank value  by # for a selection, I just want to be able to browse all the data entries and trigger the Javscript before executing REFRESH_DATA.
    Cheers,
    Erik.

    Hi Sankar,
    I fear you did not understand my problem.
    I have an input-ready query for IP with new lines.
    There is a control done by the command REFRESH_DATA on the JavaStack which does control that there is an entry for all
    the characteristics in the Query. Meaning the user has to enter # , the system does not allow a 'blank' value.
    What i try to achieve is to replace all 'blank' with '#' for all the entries in the input-ready query.
    I have a JavaScript qhich does work if I select the area but what I want is to execute this script for all new or changed entries in the input-ready query ( which is a ANALYSIS_ITEM in the WAD).
    Another way would be to disable the error message generated by the java stack which is
       Missing or invalid characteristic value in new row/column : <Name of the Characteristic>.
    Cheers,
    Erik

  • My iPad2 Apple logo (the blue box with a capital A) was deleted in error. I would like to know how to replace it or get it back.  Thanks so much . . .

    My iPad2 Apple logo (the blue box with a capital A) was deleted in error. I would like to know how to replace it or get it back.  Thanks so much . . .

    Do you mean the App Store app on your iPad ? If you do then it can't be deleted, but you might have hidden it via Settings > General > Restrictions > Installing Apps 'off' - if that is 'off' then turn it back 'on' and the app should show on one of your iPad's home screens again

  • HT3939 I buy iphone 5 from us and when i back to saudi arabia I found the model A1428 how to replace it to model suuport in saudi arabia like A1429

    i buy iphone 5 from us and when i back to saudi arabia I found the model A1428 how to replace it to model suuport in saudi arabia like A1429
    or A1429 will be support in saudi arabia

    Return the existing iPhone to the US if still in the return window then buy the model you want somewhere outside the US.
    Only the A1428GSM and A1429CDMA are sold in the US.
    Apple does not sell or offer the A1429GSM in the US.
    Apple will not exchange an iPhone for a different model in a different country.

  • I'd like to know how to replace my battery

    I'd like to know how to replace my battery?

    Apple will exchange your iPod for a refurbished one with a new battery for $79. They do not fix yours.
    Apple - iPod Repair price                       
    A third-party place like the following will replace the battery for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the battery yourself if you are up to it
    iPod Touch Repair – iFixit

  • How to replace a disk within a parity space

    I have been searching the net for better documentation on this, but so far not a lot of information on what happens when I want to do the following (this is for home use - I am not a storage admin):
    I had a JBOD array with 8 disks in it.  3x3TB and 5x2TB.  I had this array thin provisioned to 45 TiB.  When I hit about 13 TiB of storage, the drive stopped accepting new data and it was time to expand.  This made sense to me as I had
    about 19 TB or 17.3 TiB of room, minus parity, I'm about there.  Perhaps I could have done more to maximize usage, but that point is moot now.  What I did was buy and add a new 4TB disk to the array.
    I had a Storage Pool containing all my disks, and I added this new 4TB disk to the pool.  I had a Virtual Disk sitting on that pool in Single Parity mode.  After adding the drive, I was unable to get the existing virtual disk to use that drive. 
    I imagine this was due to the number of columns previously allocated to the array.  I had some ideas on how to offload the data into a new Virtual Disk with more columns, but nothing really worked, so I bought 3 more 4TB disks, reduced my data footprint
    to 12TB, copied everything off, and destroyed the array.
    Next I re-built my media server and put the original 8 disks in place, along with the fourth new 4TB disk, as well as a 200 GB disk, a 600 GB disk, and a 1.5 TB disk that I had laying around.  I'm in day 2 of my copy operation from BackupDrive1
    to the new 12 disk array.  When that completes, I want to use that disk to replace the 200 GB disk I was using as a placeholder.
    Everything I read on the internet has been inconclusive to me thus far.  Microsoft's own documentation claims that replacing a disk is as simple as removing the old disk and adding the new one, but I don't think it is.  When I tested this
    using the 4TB disk and the other 3 oddballs with a smaller subset of data, it definitely wasn't as easy as that.
    My intuition tells me that what I am supposed to do is power down the server and replace the disk I intend to replace, then add that disk to the now degraded storage pool.  At that point I should remove the old drive from the pool and repair the virtual
    disk.  However, I am nervous that "removing" a drive will decrease the number of columns, and that in the end I won't be able to use the space from the 4TB drive.  I've seen questions on the net on how to replace a disk and none of them
    seem to specifically apply to parity spaces, most are talking about either simple spaces (not happening) and mirror spaces.  I understand the difference but Microsoft's implementation of this is not as straightforward as other products I have used. 
    In other cases it was as simple as this: Physically replace disk, receive prompt that your old disk is missing, but you have a new disk, and would you like to rebuild the data from the old disk on the new disk?  Yes?  Then wait patiently while
    we painfully write 4TB of 1's and 0's and you're good to go.  I want this button in Storage Spaces please.

    Shaon,
    Thanks for your reply.  However, this does not sufficiently answer my question.
    The 200GB, 600 GB and 1.5 TB drives are temporary drives, since from my experience, adding drives to an array with 8 or more drives does not work.  I want to replace these drives with 4TB drives, leaving the smallest drive at 2TB. 
    Also, I was under the assumption that parity (which I'm imagining works in storage spaces somewhat like RAID 50), claims a space for parity equal to the size of the largest drive in the bunch, not the smallest, leaving me with a total space equal to the sum
    of the drives minus 4TB.
    I have experimented with the suggested workflow, but through the GUI this does not work.  I add the new drive, remove the missing one, and get a popup explaining that my virtual disk will be "In Repair".  However, this popup vanishes before I can
    click OK (almost certainly a Microsoft bug).  If I click OK before I finish reading this, nothing happens.  The drive doesn't repair.  I need to retire the disk through PowerShell, and then use PowerShell to repair the virtual disk.  This
    works out OK for a while, but once I start using it, the new drive infallibly gives me an error of "Stale Metadata".  I have tried this with 3 different 4TB drives, so I have doubts that this is actually a hardware issue with the drives.  More than
    likely, this is a false positive caused by an issue with Storage Spaces.  It does give me pause on continuing to use the disk, so I end up swapping the old 200GB disk back in every time and the space works fine at that point.  Right now I am attempting
    to replace the 1.5 TB disk instead, to see if that does anything.  After that, I plan on running the Optimize-Volume -DriveLetter D -Analyze -Verbose cmdlet to attempt to rebalance the data on the disk.  Should I expect that command to do anything
    useful?
    Just a side comment, this product has been around for a solid 2 years now.  I've found the documentation to be almost non-existent, with the exception of one TechNet page that every question seems to have a link to in the answer.  This page helps
    almost no-one as it lacks in examples that apply to the questions that are asked.  It gives little information on parity spaces, and does not equivocally answer the one question that many parity space users have, "What is the correct workflow for growing
    my pool?"  I understand that in a mirrored situation, you can't grow the pool without adding a certain amount of disks, but if parity functions anything like RAID 50, this should not be a limitation.  It amazes me that this is the only document Microsoft
    seems to have regarding Storage Spaces, and this single document has seemingly never been updated.  Take this feedback however you will, I truly hope that more discussion will reach the right people and help Microsoft fix the issues with a product that
    actually has a lot of promise.

  • How to replace NULL values from main table

    Dear all,
    I like to remove the NULL values from a main table field. Or the question is how to replace any part of the string field in MDM repository main table field.
    e.g.   I have a middle name field partly the value is NULL in some hundreds of records, I like to replace NULL values with Space
    any recommendation.
    Regards,
    Naeem

    Hi Naeem,
    You can try using Workflows for automatically replacing NULLs with any specific value.
    What you can do is: Create a workflow and set trigger action as Record Import, Record Create and Record Update. So, that whenever any change will occur in the repository; that workflow will trigger.
    Now create an assignment expression for replacing NULLs with any specific value and use that assignment expression in your workflow by using Assign Step in workflow.
    For exiting records, you will have to replace NULLs manually using the process given by Preethi else you can export those records in an Excel spreadsheet which have NULLs and then replace all NULLs with any string value and then reimport those records in your MDM repository.
    Hope this will solve your problem.
    Regards,
    Varun
    Edited by: Varun Agarwal on Dec 2, 2008 3:12 PM

  • How to replace double quotes with a single quote in a string ?

    Hi All:
    Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
    My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
    Thanks,
    Dima.

    Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
    SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
    REPLACE(
    STN. 'A'{code}
    Nicoals.                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to replace/remove/change font color of a character at in output

    Hi all,
    I am using rtf template to get the output of a report, however i have a condition for field "Narratives" where if field A contains 'X', I need to either get rid of the 'X', replace with '' or change the font of X to white.
    Meaning if the output is : My Name is BavaniX
    I need it to look like : My Name is Bavani
    I use the BI Publisher desktop tool to create the placeholders. Highly appreciate if someone could advise me on how to replace with '' or change X to white font or remove the X using the BI desktop tool.
    The placeholder right now looks like this <?(NARRATIVES)?>.
    Thank you.

    if you want to replace also look at
    How to remove underscore in xml tag
    Re: How to remove underscore in xml tag
    Edited by: AlexAnd on Aug 2, 2012 5:55 AM

  • How to Replace Null Value as 0 in an OBIEE11g Pivot Table? it's working 10g

    Hi,
    How to Replace Null Value as 0 in an OBIEE11g Pivot Table? it's working in obiee10g version.
    We have tried below methods
    1) criteria tab and edit the ‘column properties’ associated with your fact measure. Choose the ‘Data Format’ tab, tick to override the default format and choose ‘Custom’.
    It seems that the syntax for this custom format is positive-value-mask (semi colon) negative-value-mask (semi colon) null-mask. So this means we have a few options.
    E.g. if you want zeros (0) instead of null then enter:
    #,##0;-#,##0;0
    2) in that formula columns we have put it below case condition also ,
    Measure Column: Nom_amt --> edit formulas
    CASE WHEN Nom_amt IS NULL THEN 0 ELSE Nom_amt END
    3) we have uncheked IS NULL check box in the admin tool also
    I tried above formats still it's not working for me..kindly help me on this..
    thanks to do the needfull
    Best Regards,
    R.Devarasu

    Hi,
    Null value in database displaying as 0 in report, I need to keep value as in database, and I have one calculated row which is based on null values should also null in report.
    but it showing 0 for null values also so, my calculated row showing wrong result.
    my report is like
    col1 col2
    ABC 0
    BCD 12
    DEF -12 --this is calculated row.
    I require result like:
    col1 col2
    ABC null
    BCD 12
    DEF null --this is calculated row.
    Please let me know how I can achieve this.
    Thanks,
    Rahul

  • How to replace a field's search help of DDIC in FPM feeder class?

    Hi All,
    I want to replace a field's search help in DDIC structure, for an example, in structure HCMT_BSP_PA_XX_R0009, the field BANKL(Bank Keys) has a search help named 'H_BANKL', I want to replace this search help with other one such as 'H_BANKEY' in the FPM feeder class CL_HRESS_PER_DETAIL, I redefined such method:
    method if_fpm_guibb_form~get_definition.
    field-symbols: <fs_field_description> like line of et_field_description.
    call method super->if_fpm_guibb_form~get_definition
    importing
    es_message = es_message
    eo_field_catalog = eo_field_catalog
    et_field_description = et_field_description
    et_action_definition = et_action_definition
    et_special_groups = et_special_groups
    ev_additional_error_info = ev_additional_error_info.
    read table et_field_description assigning <fs_field_description> with key name = 'BANKL'.
    set search help name of field 'bank key'
    if <fs_field_description> is assigned.
    <fs_field_description>-ddic_shlp_name = 'H_BANKEY'
    endif.
    endmethod.
    I test it and found the search help window was replaced indeed, but all the value of import/export parameters in the new search help was lost, it means, the value of import paramer BANKS(Bank country) and the export parameter BANKA(bank name) were lost. Only the value of BANKL itself can be returned by the new search help window. Can you give me some suggestions about how to maintain the link( value exchange) between structure HCMT_BSP_PA_XX_R0009 and dynamically defined search help 'H_BANKEY' in FPM feeder class?
    I tried to use sap memory ID but it doesn't works well.

    This question was answered at [Webdynpro Forum|how to replace a field's search help of DDIC in FPM feeder class?;:
    That is because for the import and export of DDIC Search help values to work in WDA, not in FPM layer.Feeder Class can do nothing about it.

  • How to replace the root tag in ABAP Mapping

    how to replace the root tag with the certain string in ABAP Mapping
    just like
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
         <name>Lawrence</name>
    </root>
    into
    <?xml version="1.0" encoding="UTF-8"?>
    <myRootElement>
         <name>Lawrence</name>
    </myRootElement>
    i don't want to implement it in message mapping
    please give me the sample code
    thanks in advance

    Use below code
    odocument = ixmlfactory->create_document( ).
    msgtype = odocument->create_simple_element(
    name = 'myRootElement'
    parent = odocument ).
    Thanks
    Praveen

  • My iphone 5 the volume bottom does not work  how to replace it in apple sotre

    My iphone 5 the volume bottom does not work  how to replace it in apple sotre
    i read sb said they only replace the iphone by pay more 210 quid is this ture ?

    Hi Austin XQ,
    Thanks for visiting Apple Support Communities.
    Based on the information you have provided, it sounds like your iPhone needs to be serviced. The following link should help you get started with the process and has links with additional information on topics such as warranty and service pricing, battery replacement, and express replacement service.
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
    Best,
    Jeremy

  • How to  remove the Special characters like @,#,$ ,..from field

    How to  remove the Special characters like @,#,$<,..from text  field. we nedd to remove any specila char from text field .
    ex:text  = just#fi%cation@text
    the text should be justification.

    hi check this ..
    data:char(25) value '5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with 'and' .
           replace all occurrences of '&' in char with 'num' .
         write: char.
    or use this..
    data:char(25) value 'test@ing*5#4#2#&1#&',
         char1(9) .
           replace all occurrences of '#' in char with space .
           replace all occurrences of '&' in char with space .
           replace all occurrences of '@' in char with space .
           replace all occurrences of '*' in char with space .
         write: char.
    regards,
    venkat.

  • How could I replace hard coded value in my sql query with constant value?

    Hi all,
    Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
    PROCEDURE class_by_day_get_bin_data
         in_report_parameter_id   IN   NUMBER,
         in_site_id               IN   NUMBER,
         in_start_date_time       IN   TIMESTAMP,
         in_end_date_time         IN   TIMESTAMP,
         in_report_level_min      IN   NUMBER,
         in_report_level_max      IN   NUMBER
    IS
      bin_period_length   NUMBER(6,0); 
    BEGIN
      SELECT MAX(period_length)
         INTO bin_period_length
        FROM bin_data
         JOIN site_to_data_source_lane_v
           ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
         JOIN bin_types
           ON bin_types.bin_type = bin_data.bin_type 
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
       SELECT site_to_data_source_lane_v.site_id,
             site_to_data_source_lane_v.site_lane_id,
             site_to_data_source_lane_v.site_direction_id,
             site_to_data_source_lane_v.site_direction_name,
             bin_data_set.start_date_time,
             bin_data_set.end_date_time,
             bin_data_value.bin_id,
             bin_data_value.bin_value
        FROM bin_data
        JOIN bin_data_set
          ON bin_data.bin_serial = bin_data_set.bin_serial
        JOIN bin_data_value
          ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
        JOIN site_to_data_source_lane_v
             ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
            AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) lane_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'LANE'
                  AND report_parameters.report_parameter_name  = 'LANE'
             ) report_lanes
          ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) class_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'CLASS'
                  AND report_parameters.report_parameter_name  = 'CLASS'
             ) report_classes
          ON bin_data_value.bin_id = report_classes.class_id
        JOIN edr_rpt_tmp_inclusion_table
          ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data_set.start_date_time >= in_start_date_time
         AND bin_data_set.start_date_time <  in_end_date_time
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       =  bin_period_length;
    END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
    bin_data.bin_type            =  2But I dont want any hard coded number or string in the query.
    How could I replace it?
    I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
    bin_type     CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
    Thanks.
    Edited by: user10641405 on May 29, 2009 1:38 PM

    Declare the constant inside the procedure.
    PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
                                        in_site_id             IN NUMBER,
                                        in_start_date_time     IN TIMESTAMP,
                                        in_end_date_time       IN TIMESTAMP,
                                        in_report_level_min    IN NUMBER,
                                        in_report_level_max    IN NUMBER) IS
      bin_period_length NUMBER(6, 0);
      v_bin_type     CONSTANT NUMBER := 2;
    BEGIN
      SELECT MAX(period_length)
        INTO bin_period_length
        FROM bin_data
        JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                           site_to_data_source_lane_v.data_source_id
        JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time >=
             in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time <
             in_end_date_time + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type = v_bin_type
         AND bin_data.period_length <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
      INSERT INTO edr_class_by_day_bin_data
        (site_id,
         site_lane_id,
         site_direction_id,
         site_direction_name,
         bin_start_date_time,
         bin_end_date_time,
         bin_id,
         bin_value)
        SELECT site_to_data_source_lane_v.site_id,
               site_to_data_source_lane_v.site_lane_id,
               site_to_data_source_lane_v.site_direction_id,
               site_to_data_source_lane_v.site_direction_name,
               bin_data_set.start_date_time,
               bin_data_set.end_date_time,
               bin_data_value.bin_id,
               bin_data_value.bin_value
          FROM bin_data
          JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
          JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
                                 bin_data_value.bin_data_set_serial
          JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                             site_to_data_source_lane_v.data_source_id
                                         AND bin_data_set.lane =
                                             site_to_data_source_lane_v.data_source_lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'LANE'
                   AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
                                                                                         report_lanes.lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'CLASS'
                   AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
                                                                                            report_classes.class_id
          JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
                                              TRUNC(edr_rpt_tmp_inclusion_table.date_time)
         WHERE site_to_data_source_lane_v.site_id = in_site_id
           AND bin_data.start_date_time >=
               in_start_date_time - numtodsinterval(1, 'DAY')
           AND bin_data.start_date_time <
               in_end_date_time + numtodsinterval(1, 'DAY')
           AND bin_data_set.start_date_time >= in_start_date_time
           AND bin_data_set.start_date_time < in_end_date_time
           AND bin_data.bin_type = v_bin_type
           AND bin_data.period_length = bin_period_length;
    END class_by_day_get_bin_data;

Maybe you are looking for

  • Memory on iPad 4 and Photo Stream

    I have an ipad 4 and it shows that I have 2.5 GB of pic's on it but there is nothing on my camera roll.  Does my photo stream take up memory on my actual device?

  • Business Object Installation Error code STW00140

    Hi Gurus, During Installation I am getting error The product keycode you entered is  not valid : STW00140 I  am installing on XP. could any one help me?  Thanks in advance Jack

  • CC won't install

    Recently purchased 5 seats of CC for my company, and have established myself as administrator. Have successfully deployed 4 licenses: 1 to myself and 3 to my staff. However, CC simply won't install for me. On my main machine, it made it through the C

  • Photoshop CC 3D render reflections

    Hi, Just upgraded from photoshop CS6 to CC and using some existing files but when 3D render kicks in the ground plane reflections disappear, has it changed or am I doing something wrong or is it a bug?        Before Rendering                         

  • Orchestration Dependeny Queue not being updated

    Hello, We want to increase the consumer count for the orchestration dependency queue from 16 to 30. We have made the changes to the weblogic-ejb-jar.xml updated the oms.ear. But unfortunately, the consumer count is not being updated. Can someone plea