Query works but not in a funtion

i have this query... select sum(amount) from here and there where id=myid and mydate =desireddate... works flawlessly...
but when i put this query in a function and pass on the parameters does not work... function looks like this.....
create or replace function myfunction(myid varchar2, desired date) return number is
amount number;
begin
here goes query...where id=myid and mydate=desireddate;
return amount ;
end;
It seems something about the mydesireddate parameter, cause when i manually put the value works fine....currently function returns all mydate rows, i just want mydesired date rows.
thanks in advance....

currently function returns all mydate rows, i just want mydesired date rowsCheck if there is a column in the table with the same name as the function parameter. It's the most probable reason of such DML operations behaviour in PL/SQL procedures and function.
Rgds.

Similar Messages

  • Flashback query works, but not flashback versions query

    This is a test database (Oracle10g 10.1.0.5), not in archivelog mode. I deleted one row 2 hours ago. I can still use flashback query:
    select * from tm_instances as of timestamp to_timestamp('STARTTIME_HERE') to view this row. But I can't use the following flashback versions query:
    SELECT versions_startscn, versions_starttime,
    versions_endscn, versions_endtime,
    versions_xid, versions_operation from tm_instances VERSIONS BETWEEN TIMESTAMP to_timestamp('STARTTIME_HERE') and MAXVALUE
    It gave the following error:
    ORA-30052: invalid lower limit snapshot expression
    So I guess flashback query works better than flashback versions query?
    undo_retention is set to 900 by default here.
    Thanks,
    Hai

    currently function returns all mydate rows, i just want mydesired date rowsCheck if there is a column in the table with the same name as the function parameter. It's the most probable reason of such DML operations behaviour in PL/SQL procedures and function.
    Rgds.

  • Query works but not in package

    Hi,
    I have this query that executes fine if I put it in a sql editor, I get a nice result set. However, when i put it in a procedure (in a package) I get the following error:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current ex
    Why is this? The procedure uses querys from another schema, but since it works in sql editor?...
    I have granted selects on all the tables in used by the SP.
    Anyone?

    They are quite big procedures. But if it works in the editor, wouldn't it work in a SP? Can someone explain that to me...
    CREATE OR REPLACE PACKAGE BODY SP_PST AS
         PROCEDURE GetCountyList(rs out RecSet)
         IS
         BEGIN
         open rs for
                                  select komm.1kod, laen.kod, laen.namn, komm.2kod, komm.namn, medi.kod, mp.namn_off, 'cut' utgiv, round(100*hh.upp/hhantal.antal, 2) hh2, round(100*hh.upp/hhantal.antal, 0) hh, (
                        /* breaks here*/     select max(anns_pris) pris
                             from ts.apls, ts.aprs
                             where apls.date_fom <= to_date('2006-01-01', 'yyyy-mm-dd') and apls.date_tom >= to_date('2006-01-01', 'yyyy-mm-dd')
                             and (apls.off is null or apls.off < sysdate) and apls.kod=aprs.kod
                                  and apls.date_fom=aprs.date_fom
                                  and aprs.frmt='mm' and prvarkod='-' and region='-' and infvdag='-'
                                  and (plac='ETKU'
                                  or (plac='ETKUM' and not exists (select 1 from ts.aprs a2 where aprs.kod=a2.kod and aprs.date_fom=a2.date_fom and aprs.frmt='mm' and prvarkod='-' and region='-' and infvdag='-' and plac='ETKU'))
                                       or (plac='FEKU' and not exists (select 1 from ts.aprs a2 where aprs.kod=a2.kod and aprs.date_fom=a2.date_fom and aprs.frmt='mm' and prvarkod='-' and region='-' and infvdag='-' and plac in ('ETKU', 'ETKUM'))))
                                  and apls.kod=medi.kod
                             ) pris
                   from ts.medi, ts.laen, ts.komm,
                        subquery     
                        ) ml,
                        another subquery
    ) mk,
                        yet another subquery                     ) mp,
                        subquery again
                        ) hh,
    subquery...
                        ) hhantal
                   where big whereclause
              EXCEPTION
         WHEN NO_DATA_FOUND THEN
         Null;
         WHEN OTHERS THEN
         -- Consider logging the error and then re-raise
         RAISE;
         END GetCountyList;
         PROCEDURE GetMunicipalityList(p_countyCode VARCHAR2, rs out RecSet)
         IS
         BEGIN
         open rs for
                   select moreyadayada.... similar to the first one...
              EXCEPTION
         WHEN NO_DATA_FOUND THEN
         Null;
         WHEN OTHERS THEN
         -- Consider logging the error and then re-raise
         RAISE;
         END GetMunicipalityList;
    END SP_PST;
    Added code...

  • Problem with drivers for HP B109 a-m all-in-one, have printer working but not scanner in windows 8

    Still have a problem with the drivers in Windows 8 release preview, for my HP B109 a-m all-in-one, have printer working but not scanner, is there any chance of a fix before final release of Windows 8 ?.

    Review my post here:
    http://h30434.www3.hp.com/t5/Windows-8-Release-Preview/SOLUTION-Get-Win-7-Printer-Drivers-HP-Solutio...
    And see if something similar will work for you.

  • My Mac Mini doesn't recognize my Avengers DVD--it keeps saying "Supported disc not available." I've tried other DVD's which work, but not this one. itunes and everything else has been updated to the newest versions. Help?

    My Mac Mini doesn't recognize my Avengers DVD--it keeps saying "Supported disc not available." I've tried other DVD's which work, but not this one. itunes and everything else has been updated to the newest versions. Help? Also...It doesn't recognize the digital copy DVD.

    I have ALL the exact same symptoms as on my home computer.
    It sure sounds to me like something on the iPod is broken. If it's under warranty then I would send it back for repair. If not, check out some of the web repair services, such as iPodResQ etc.

  • Allt he links in the header of any websites are not working, I reinstalled fiorefix and it s the same. No problem in others browser. the tool bar is working but not the link sinside the web page located between the top 300px height

    all the links in the header of any websites are not working, the cursor is not changing into pointer and no way to click on any link located at the top of any website page. I reinstalled firefox and it s the same. No problem in others browser. the tool bar is working but not the links inside any web page located between the top 300px height.
    So I can t tlog into any website, i cant write an email as the compose button is located in the top of the page.. Please help, i have all my bookmarks into my firefox...

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Speakerphone problem - lost voice from speakerphone while playing music or gaming youtube, while call or voice recording playing - all works fine, so speakerphone is working but not on all apps. hard reset done - no changes

    or gaming youtube, while call or voice recording playing - all works fine, so speakerphone is working but not on all apps. hard reset done - no changes.
    iphone 4
    SOLVED plugin to charger solved it - so problem was with contacts -- no idea why - phone is new - no water - no havy dust - usual using  
    hope will never return. Thanks

    We checked it with an iPhone 5 in house multiple times and could not reproduce this Problem. Must be something specific to your device. Maybe your speakerphone volume is turned down completely?
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • Hi!My 6 month old MBP 13" has suddenly stop charging.Mac is working,but not charging

    Hi!My 6 month old MBP 13" has suddenly stop charging.Mac is working,but not charging

    Troubleshooting MagSafe adapters  http://support.apple.com/kb/ts1713
    If you need to pursue further you can do it on-line,  start here
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • My iPad cannot connect to my internet.  the internet is working but not with my ipad.

    my iPad cannot connect to my internet.  the internet is working but not with my ipad.

    Call your ISP (Internet Service Provider) and explain them your issue, it could range from having your router configured incorrectly to having a wiring issue. Personally, I have Comcast and they are great, no issues, and awesome customer service.
    Hope you get up and running ASAP

  • HT4993 My volume down button is not working.  The UP button works, but not the down button.  I have tried to restart it and that didn't solve the problem.

    My volume down button doesn't work on my iPhone.  The UP buttown works, but not the down button.  I have tried a hard reset and that didn't fix it.

    Try this.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • ICloud keeps asking for password but will not take it. All other devices work but not my IMac???

    ICloud keeps asking for password but will not take it. All other devices work but not my IMac???

    Exactly which password are you inputting? iCloud looks for your AppleID password.

  • Wake on Lan (works, but not always)

    Iam trying to get Wak on Lan working on my iMac. It works, but not always. When I put my mac to sleep en send the magic package, my mac turns back on. But when my mac turns to sleep and I wait a few hours (the next morning), my Mac doesn't respond to the same magic packag. When I wake up the Mac by hand, and put it back to sleep again, the magic package works again en turns the mac on.
    It almost looks like the mac goes into a deeper sleep mode after a few hours. Does anyone knows what could ben the reazon.

    mmm, It seems like my mac doesn't always turns to sleep mode. Most of the time it only turns off the screen (solid light). My energy settings are 10 minutes for the screen and 15 minutes for the mac. But after turning of the screen it never turns to sleepmode. Ecxept when I put it to sleep manualy.
    Strange thing is: when the screen is turned of, shouldn't I be able to get tot my files... (I can't actualy).

  • Sap xi SCENARIO source directory working ,but not working target directory

    sap xi SCENARIO source directory working ,but not working target directory..
    plz help me

    Hi,
    Be more specific on the problem you are facing so that the ppl here can help..
    looks like your are trying to file to file scenario and the file is not generating at the target folder ...
    then check the communication logs of the receiver adapter using RWB->CC logs..
    post the error you have received there..
    HTH
    Rajesh

  • Can't sync ical on my iphone and imac. email and note work but not ical.  can anyone help.

    can't sync ical on my iphone and imac. email and note work but not ical.  can anyone help.
    thanks
    bmoreimac

    So how can i make it work that way, i asked one of my friends, and she says it works like that...when she delete the email on her iphone it is deleted on the mac too, what do i do to change this?....my mail it's hotmail, i don't know if its relevant

  • TS1702 facetime on my iphone works but not on my ipad

    Facetime on my iPhone 4S works but not on my iPad (3rd or 4th Gen)

    From the iPad User Guide:
    To use FaceTime, you need an Apple ID and a Wi-Fi connection to the Internet. When you open
    FaceTime, you may be prompted to sign in using your Apple ID, or to create a new account.
    Make a FaceTime call: Tap Contacts, choose a name, then tap the phone number or email address the person uses for FaceTime.
    You can also make a FaceTime call from the Contacts app.
    Rotate iPad to use FaceTime in either landscape or portrait orientation. To avoid unwanted orientation changes, lock iPad in portrait orientation. See Portrait and landscape orientation on page 20.

Maybe you are looking for

  • How do I export from Compressor 4 to iDVD with chapter markers?

    I get that Final Cut Pro X does not create chapter markers. I send it to Compressor 4 to do this. Ok, so far, so good. How do I export this so that I can then author the DVD to include a menu page, etc? Do I do this in iDVD?  If so, what format, as I

  • Network File sharing in SharePoint 2013 portal

    Hi Everyone I have a set of network folders(shared folder in some server) and want to make use of all this in SharePOint as a portal. So that i can eliminate the use of Network folder sharing concept. Bacially i need to know whether we have any OOB t

  • Transfer data to MacBook Pro

    Hello, So my G5 broke (3 months to repair) and I currently only have the hard drive from it. Is there anyway to transfer the data from that hard drive to my MacBook Pro? Could a Genius at the Apple store help with this? Thankful for any advice - it's

  • Status NOTE on Vendor notifications

    Dear QM gurus, When we create vendor notifications manually, the system sets automatically the status NOTE (external). This is fine; I believe the system assumes this because this is normal for vendor notifications. When the notification is confirmed

  • CS3 Photoshop RAW error

    Hello, I am using CS3 Photoshop Master Collection on a Vista and a Windows 7 computer's. I am unable to open RAW files due to the following error: Could not complete your request because of a program error. I am trying to open up a RAW file from a ca