Is it possible to use parameter in a user query with subquery ?

Hi ,
i need to use parameter ( [%0] ) in user query using a subquery , but i have errors message when i execute the query 
example :
SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  =N'[%0]'
union all
SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  =N'[%0]'
works fine
but ( exactly the same query in the subquery )
Select t2.Docnum ,t2.cde , t2.fact from
SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  =N'[%0]'
union all
SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  =N'[%0]'
) t2
return an error message
the same query without parameter works fine too :
Select Docnum ,cde , fact from
SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  ='C1'
union all
SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  ='C1'
) t2
Is it possible to use parameter in a subquery ?
thanks

Try this one:
declare @cc nvarchar(20)
set @cc=/*Select c.cardcode from OCRD c where c.cardcode=*/'[%0]'
Select Docnum ,cde , fact from
SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  =@cc
union all
SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  =@cc
) t2

Similar Messages

  • Use plan from stored_outlines from query with different syntax?

    Hello,
    I'd like to know is there any ability to use via stored_outlines plan from query with different syntax?
    Database version - 11.1.06
    If yes, maybe you'll take a look at steps (based on Metalink 726802.1), what I tried to do to make it work (with no success):
    alter session set create_stored_outlines=good;
    run good query
    create private outline good from SYS_OUTLINE_0... -< GOOD
    alter session set create_stored_outlines=bad;
    run bad query
    create private outline good from SYS_OUTLINE_0... -< BAD
    update ol$ set sql_text, textlen, signature, hash_value, hash_value2 from BAD to GOOD records
    leave ol$hintcount for GOOD untouched
    delete ol$ where ol_name='BAD';
    delete ol$hints where ol_name='BAD';
    delete ol$nodes where ol_name='BAD';
    execute dbms_outln_edit.refresh_private_outline('GOOD');
    alter session set sql_trace=true;
    alter session set use_private_outlines=true;
    run bad query
    examine trace file and find that it use execution plan different from both bad and good queries
    PS: Originally bad query is posted already Re: Poor performance while join of 2 comprehensive large views and small table
    PPS: Also I review thread CBO not picking correct indexes or doing Full Scans
    Thanks,
    Sergiy
    Edited by: kiberpress on Sep 30, 2009 6:59 AM

    A query with different syntax would result in a different hash value.
    Stored outlines work based on hash value.
    Your question is probably answered now.
    Sybrand Bakker
    Senior Oracle DBA

  • Is it possible to use Adobe Illustrator in multiple computers with the same account?

    Hi guys,
    So our company is a small designing tile company,
    we wanted to purchase the Adobe Illustrator and was wondering if it was possible to use it in multiple computers with one account, as we have two computers that are frequently use for designing, or do we have to buy two separated Adobes Illustrators for each computer?
    Thanks

    From the End User License Agreement (EULA):
    2.1.3 Portable or Home Computer Use. Subject to the restrictions set forth in Section 2.1.4, the primary user of the Computer on which the Software is installed under Section 2.1 (“Primary User”) may install a second copy of the Software for his or her exclusive use on either a portable Computer or a Computer located at his or her home, provided that the Software on the portable or home Computer is not used at the same time as the Software on the primary Computer.
    So, while it CAN be installed on more than one computer, they may not both be in use at the same time.
    --OB

  • Possible to use mySQL, an open source program with Labview without the use of toolkit, just like we can do with MySQL with Command line.

    Hi i am trying to see if I can use sys exe .vi to execute Mysql commands. Is it possible to use without toolkit?
    regards,
    Clement

    Hi. I know there's a free toolkit that use ADO. But the problem is that my company not wish to splurge on the purchase of MS database server or  alikes, but prefer to run MySQL. So can I do the labview with the MYSQL only?
    Clement

  • Is it possible to use an ipad2 as a keyboard with a ps3 via Bluetooth

    Is there a app, or even possible to use your iPad to connect to a ps3 via Bluetooth for use of a keyboard or transferring files even.

    The iPad cannot act as a Bluetooth keyboard for other Bluetooth devices and iOS does not support the File Transfer Bluetooth profiles for transferring files to other Bluetooth devices.
    There are over 20 different Bluetooth profiles, and no device supports all of them. In the case of iOS Apple has included support for a small subset of the profiles.

  • Possible to use non-AT&T wireless card with iPad??

    Thinking of getting an iPad, however I travel frequently and after looking at the outlandish prices for international data plans, I am about ready to give up on the idea. Anyone know if it is possible to use a non-AT&T wireless card with the iPad? I'm guessing there would be a compatibility issue of some sort.

    The 3G iPad is not locked to a particular service provider. You can get a local Sim card and data plan in many countries. This article will give you some idea of what's available: http://gigaom.com/2010/05/10/ipad-data-plan-guide/

  • Is it possible to use if then else EL expression with DependsOnItem?

    I have an item in a form layout which depends on items depends on the value of another item (DocumentType).
    If DocumentType = N then DependsOnItem --> Name
    If DocumentType=J then DependsOnItem --> Name, Mapping
    With EL I have tried to use the following expression:
    DependsOnItem --> #{bindings.DocumentType.inputValue=='J' ? (Name,Mapping) : (Name)}
    But this does not work. Can anyone tell me if this is possible with EL and DependsOnItem?

    What is the problem with specifying both Name and Mapping as depends on item? It only generates a partialTriggers property, so if redundantly make an itejm dependent (when the value = 'N') it shouldn't matter.
    Steven Davelaar,
    JHeadstart team.

  • Possible to use Acrobat Pro 9.3.2 with Safari 5?

    Prior to recent installation of Safari 5, I was able to view pdfs in my browser window using the fully-featured Acrobat plug-in. Now, the only choice I seem to have is disable the Acrobat reader and use Preview.
    Is there any way to get my Adobe functionality back?
    Adobe tells me 9.3.2 Pro is the latest. Safari 5.0 seems to be the latest too.
    I am running 10.5.8.
    Thanks for any help you can provide.

    After considerable experimentation, I've gotten it to work, but with issues I'd like to pursue:
    1. After a few quits, restarts and cache clearing, I have noticed that I cannot view pdfs (a) on websites I've created using Rapid Weaver 4.4.1 (latest) (b) if they are password protected unless (c) I have saved the username and password to my keychain.
    2. All other commercial websites, protected or otherwise, that have pdfs I can download without difficulty.
    3. All pdfs on sites/directories of my own creation that are not password protected download and show just fine.
    Is this an issue with my Rapid Weaver pages? My web host?
    I'd like to be able to log in on my laptop, enter my username and password to gain access to the site, without putting the info on my keychain, if possible.

  • Is it possible to use run-time configuration in conjunction with Session Manager?

    I'm trying to avoid using MAX, basically because it's a pain for users to configure MAX when the application already knows what the configuration is. I actually get the configuration from a database, but that's another story. I've experimented with run-time configuration (see page 4-31 of the 'IVI Driver Toolset' manual) and it works fine. However, when I try to use this in conjunction with Session Manager, session manager complains that my logical name is not a driver session name. I suspect that Session Manager is looking up logical names from a different source, therefore run-time configuration won't work. Any suggestions? I've attached the files I'm working with.
    Attachments:
    SessionMgrTrial.zip ‏41 KB

    Hello Mark:
    The Session Manager GetLogicalNames method does not distiguish between logical names and virtual instrument names. A user of the method cannot ask for just logical names or just virtual instrument names. Right now you always get both. The new function is called InstrSessionMgr.GetNames. Notice that the online help file says Boolean for the flags parameter when it is an enum.
    Hope this helps. If you have any further queries, please let us know.
    -NI support
    National Instruments - Software IS the instrument!
    Attachments:
    help.gif ‏22 KB

  • Is it possible to use Facetime between Mac and iPad with the same Apple ID?

    Hello,
    I have a MacBook Pro and an iPad. May MacBook is used by my wife and me at home. I take the Pad with me when I travel. On the MacBook I have and Apple ID registered. It is the same I use with the iPad. Do I need a differnt ID for my wife if we want to use Facetime? Or do I need to create a seperate user-profile for my wife on the MacBook?
    Thanks for your feedback in advance.

    Hi
    I use the same apple id for the same thing when i travel between myself and people at home over my iphone and the ipad i leave at home always seems to work of for me
    I normally just give it a little test before i leave each time by signing in of both devices and trying ringing myself
    Hope this helps

  • Possible to use old macbook (mini dvi port) with 24 in LED display?

    Is there a combo of adaptors that will allow me to use my older macbook (mini-DVI port) with the new apple LED screens- i.e. adaptors allowing mini-DVI to mini displayport connector that comes with monitor?

    You need this component and a mini DVI to DVI adapter.
    (53913)

  • Is it possible to use top_of page in SAP query SQ01

    Can I use a top_of page in my Query SQ01???
    If is yes, how can I do that???

    Hi Alvaro,
    Header and footer are provided for these sort of requirements.
    Please check the menu options.

  • Is it possible to use a MacBook Pro 9.1 with Snow Leopard

    Hallo,
    i tryed out to install a macbook pro 9,1 with Snow Leopard, but by loading the drivers he stops with booting.
    The version i try out is 10.6.8 and i tryed to boot from an extern drive also with 10.6.8 with the newest updates.
    I hope to get some tipps i can try out.
    Thanks a lot!
    tony

    tony.scotto wrote:
    Hallo,
    i tryed out to install a macbook pro 9,1 with Snow Leopard, but by loading the drivers he stops with booting.
    The version i try out is 10.6.8 and i tryed to boot from an extern drive also with 10.6.8 with the newest updates.
    I hope to get some tipps i can try out.
    Thanks a lot!
    tony
    While the 2011 MBP's that shipped with Lion can be made to run Snow Leopard as long as you have the appropriate installer disk for 10.6.7 or later, yours is a 2012 MBP and most likely can never be made to run Snow Leopard because the necessary hardware support drivers (e.g., USB 3.0 support) simply aren't a part of that OS.

  • Is it possible to use the UC-33e (surface control) with FCP ?

    If it's the case, how can you do it ?
    Thanks

    No, FCP has no MIDI implementation to support generic assignable fader boxes. It's pretty much stick to devices that support the Logic/Mackie Control protocol. Unless FCP gets the proper System Exclusive handshake, it will ignore continuous controller messages.

  • Trouble with using WoW on Mutable User Accounts with new MacBook Pro

    My son just got a new MacBook Pro*. I installed WoW on his account and created an account for me; both are admin accounts. He can startup WoW just fine, but when I start the Launcher, I get a message that the launcher can't download information about the next patch, and to check my network. If I launch the game directly, the icon just bounces on the dock and then quits.
    I have checked the permissions and they look good.
    The console log reads:
    11/18/10 12:48:40 PM Firewall[58] Launcher is listening from 0.0.0.0:9112 proto=6
    11/18/10 12:48:43 PM Launcher[490] nRet = 1
    OR without the firewall
    11/18/10 12:55:58 PM Launcher[544] nRet = 1
    * Model Name: MacBook Pro
    Model Identifier: MacBookPro6,2
    Processor Name: Intel Core i7
    Processor Speed: 2.66 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2

    I have posted to the Mac Tech support forum, and heads are being scratched. I was wondering if 10.6 was different from 10.5 with regard to mutable users. NOTE that WoW will only work on intel based macs now. so this poor tired old box is done for.
    Besides, as I hear it, it is a legacy machine now.

Maybe you are looking for

  • How do I retrieve data from my iBook?

    Hello, my iBook is experiencing logic board issues for the nth time (where n is a large number!). This time around it won't stay on long enough for me to retrieve my data from it. I know I can use target disk mode to retrieve my data from my iBook bu

  • Adapter Engine Monitoring

    I have simple file to file scenario. Message monitoring shows duplicated entries for each message For example Sender   | Receiver | Interface System1  |          | Interface1 System1  | System2  | Interface1 Could you explain this strange behavior?

  • Locking a particular row in a table control

    Hi All, I have module pool program in which table control is used. I would like to know whether it is possible to lock a particular row in the table so that another person will not be able to edit it until the first user completes his work. It should

  • Advice? Displaying multiple text streams

    I've got a file format that contains up to 2 essentially independent styled text streams. I would like to display each stream in a visually independent text view (i.e. if 2 text streams, then 2 panes with scroll bars) and allow changes to be saved ba

  • Is it possible to remember the position of the plugins

    Hello Is it possible to remember the position of the plugins in STP? If I hide the application or add a new effect, the plugins reset their position.. thx a lot!