Syntax Question

Hi,
I can't seem to figure out the syntax for a pl/sql function body returning sql query:
I have a dynamic query so it's in single quotes
(which is extremely long so I've just abbreviated it to give the general idea):
tmp_var := 'select a,
b,
c,
(select .......) "Col 4"
from table1
where a = 1';
It throws an error saying that it can't find the From clause or that whatever comes before it in the query is an invalid identifier. How can I have double quotes within single quotes? i've tried using 2 single quotes on both sides of Col 4 but that didn't work. I've also tried putting the double quotes between 2 single quotes ''"''. That didn't work either.
Thanks,
Nora

Nora,
I can't tell if Col 4 is supposed to be an alias for you select statement or a hardcoded value. It looks to me like it is an alias. If so, why not just make it col_4? Then you can just change the column header to be whatever you want. If you want it to be an alias, then what you have looks correct (though you might try to put a space before the word "from").
If you want it to be a hardcoded value, then you want two single quotes ''Col 4''.
I assume that you have
return tmp_var;
at the end of your pl/sql block...
Hope this helps.
Anton

Similar Messages

  • A syntaxic question...

    Hi guys,
    I've posted about this on this very forum before, but I can't find my own question... and the answers that you people provided, so I'll do it again: what's wrong with the following, knowing that I have Developer Tools installed and that I clearly remember writing a script along those lines a long time ago, when I was still using Tiger?
    Here goes:
    "move mouse
    720, 450 {from left, from top}"
    Where the goal is to move the mouse pointer center screen on startup (don't bother about compiling and saving as an app, just about the right syntax). Something's missing, but I can't put my finger on it...

    The app developer once told me that the delay in activating the mouse was built-in, because it took the Trackpad some time (usually no more than a second or two) to fully activate. So I guess I can't get anything better than what I already have: at least I don't accidentally trigger the Apple menu by trying to move my mouse pointer to screen center...
    Well, trying to stress my brain to figure out an impossible solution.
    FWIW, here's the code, before modification:
    move mouse {720, 450} -- {from left, from top}
    click mouse
    delay 0.1
    click mouse
    delay 0.1
    move mouse {730, 460} -- {from left, from top}
    I'm going to add a two-second delay between the two mouse clicks, just in case. I'll keep you posted. As for the compliment, it's amply deserved, and I'm not the only one on this forum who says so...
    I you are trying to simulate a double click, you need to make the delay closer to what a human would do. Two seconds will most likely turn the double click into two single click.
    2
    All this is probably not need since you fessed up to it being a driver problem.
    Cheers!
    Thanks again for your rewarding comments.

  • 11g pivot query syntax question

    I searched the forums and I have seen questions similiar to the one I am asking, but its not the exact same issue.
    I need 3 fields in my 'for' clause. I get 'column ambiguously defined. I think I get this error for a different reason that other people asking the question.
    The others seem to be doing more than 1 function in the pivot clause and those need an alias. I give an alias with my 1 function and still get an error.
    ORA-00918: column ambiguously defined
    I used aliases like the recommendation in other posts and I still get the same error. I think I need 3 columns in the for clause.
    --note that this is just a test table. These are not real names going into production
    create table pivot_tab (
    pk1 number,
    pk2 number,
    myElement varchar2(30),
    myElementDate date);
    pk1,pk2 are the unique key.
    I need this to return as: the vlaues after pk2, can be any alias. This is just an example.
    pk1  pk2  MY1_DATE, MY2_DATE, MY3_DATE
    select *
         from pivot_tab
        PIVOT ( max(myElementDate) for myElement
                in (''MY1','MY2','MY3'))
    I saw a couple of references to this syntax, but I get syntax errors.
    ora--00906: missing parentheses. So I dont think this syntax works.
    select *
         from pivot_tab
        PIVOT ( max(myElementDate) for (pk1,pk2,myElement)
                in (''MY1','MY2','MY3'))Edited by: Guess2 on May 6, 2013 6:50 AM

    don't have any sample data or expected results to test this with maybe
    SELECT *
      FROM (SELECT pk1,
                   pk2,
                   myelement,
                   myelementdate
              FROM pivot_tab) PIVOT (MAX (myElementDate)
                              FOR myElement
                              IN ('MY1' AS MY1, 'MY2' AS MY2, 'MY3' AS MY3));or maybe you are trying to pivot by the first part of the pk?
    with pivot_tab as (select 1 pk1, 2 pk2, 'MY1' myelement, sysdate myelementdate from dual union all
                       select  1 pk1, 3 pk2, 'MY2' myelement, add_months(sysdate,2) myelementdate from dual union all
                       select  1 pk1, 4 pk2, 'MY3' myelement, add_months(sysdate,3) myelementdate from dual union all
                       select 2 pk1, 5 pk2, 'MY1' myelement, sysdate myelementdate from dual union all
                       select  2 pk1, 6 pk2, 'MY2' myelement, add_months(sysdate,6) myelementdate from dual union all
                       select  2 pk1, 7 pk2, 'MY3' myelement, add_months(sysdate,7) myelementdate from dual )
    SELECT *
      FROM (SELECT pk1,
                   myelement,
                   myelementdate
              FROM pivot_tab) PIVOT (MAX (myElementDate)
                              FOR myElement
                              IN ('MY1' AS MY1, 'MY2' AS MY2, 'MY3' AS MY3));
    PK1     MY1     MY2     MY3
    1     5/6/2013 10:07:40 AM     7/6/2013 10:07:40 AM     8/6/2013 10:07:40 AM
    2     5/6/2013 10:07:40 AM     11/6/2013 10:07:40 AM     12/6/2013 10:07:40 AMEdited by: pollywog on May 6, 2013 10:08 AM

  • More syntax questions about nested symbols

    I have a symbol timeline that does everything I need it to do except to access a function within the stage symbol. I would have thought that calling the function in the stage symbol from a nested symbol (which is loaded dynamically, if that makes any difference) would be something along the lines of:
    sym.getComposition().getStage().gotoNextSlide("slide5");
    but no luck. I can alert the stage itself as [Object Object], which brings up another question. Is there an always-available property of objects that one can alert or trace to make sure the correct object is being targeted? I've had no luck with the symbol's id, name, or symbolName.

    Sure. You've seen one form of the project I'm working on, though I'm at the next speedbump. Here's an excerpt of the involved parts.
    I have the stage symbol and within that symbol, I have a function:
    function gotoSlide(slideName){
              fadeTo(slideName);
    function fadeTo(slideName){
         /// this all works fine, when called from the main timeline
    In the composition, I'm loading slides from the library and on the timeline of one of those slides is the following.
    navHidden = true;
    var trueButton = sym.getSymbol("answers").$("true");
    trueButton.bind('click',goNext);
    function goNext(){
              sym.getComposition().getStage().gotoSlide("slide_05");
    I know there are other syntaxes I could use but refactoring is in the future. The console log I get is:
    Object [object Object] has no method 'gotoSlide'
    It's slide 5 in these:

  • Fixing this Scalar Variable Syntax question

    Please help me to correct this syntax for this practice question below.
    /* Create and set a Variable equal the number of Flights that were late.*/
    DECLARE @FlightsLate varchar(50)
    SET @FlightsLate = (SELECT* FROM
    Flights WHERE Ontime = 0)
    SELECT @FlightsLate

    If you want to get the total numbers that are late you need to do this
    DECLARE
    @FlightsLate varchar(50)
    SET
    @FlightsLate = (SELECT count(*) FROM
    Flights WHERE
    Ontime = 0)
    SELECT
    @FlightsLate
    Assuming that Ontime =0 means Late
    Javier Villegas |
    @javier_vill | http://sql-javier-villegas.blogspot.com/
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you

  • ??? a launchd syntax question

    When running cron jobs, I think (somebody please correct me if I'm wrong or verify if I'm right) that if a person wants to schedule a job to run monthly, but rather than on a specific date of the month (e.g., 1st, 2nd, etc.), it is desired to have the job run on, say, the second Saturday of the month, (s)he would make a crontab entry that looked something like this:
    #minute hour    mday    month    wday   who     command
    36          02       8-14         *          6       root     periodic monthly
    If I got this down right, this would run "monthly" on Saturday, so long as the date of Saturday was between the 8th and the 14th, inclusive, i.e., the second Saturday of the month.
    If this is a correct assumption on my part (to include my assumption on syntax), then comes the question du jour:
    How might one modify the /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist file to do the same thing?
    Thanx in advance
    2001 Quicksilver G4   Mac OS X (10.4.5)  
    2001 Quicksilver G4   Mac OS X (10.4.5)  

    I don't believe you can.
    The launchd.plist((5) files don't take ranges for dates, or at least aren't documented to.
    One other thing to note with periodic launchd(8) events - there's long been an issue in the kqueue(2) call that drives launchd(8) such that event timers don't really work the way the launchd.plist(5) man page says they do. Instead of firing when a machine awakens from sleep if an event occurred while the machine was asleep, events instead only accumulate time while the machine is up and running.
    So say, for example, you told launchd(8) you wanted to run a script at 6:00 AM tomorrow morning. You continue using your Mac, but it goes to sleep at midnight and you awaken it from sleep at 8:00 AM.
    The launchd.plist(5) man page says the event will be run when the system awakens, but it will not; rather the six hours of system uptime the machine was asleep must elapse first, meaning your "6:00 AM" script will actually run at 8+6 = 14:00, or 2:00 PM.
    While this is better than cron(8) which would just ignore the event that occurred while the machine was asleep, it's certainly not the behavior that launchd.plist(5) documents, either…
    Dual 2 GHz G5 (Quad on order!)   Mac OS X (10.4.5)  

  • Please help with an ICM script editor syntax question.

    I need to modify a set variable node.  What I have now is Call.PeripheralVariable8+".wav" and this works.  What I need it to say is Call.PeripheralVariable8+anything+".wav" but when I insert an * for the anything it's seen as a multiplier.  What's the syntax to do this?  The anything I need to add is _9xxx where xxx are other numbers, but the _9 will be in all, if that helps any.  Thanks in advance !!

    You can use the concatenate() function to build up your string, as you no doubt know.
    As far as the wildcard goes ... your intention must be to try to SET the call variable and later on test the call variable with an IF node. Is that right?
    You would be able to test parts of the string using the substr() function - which is based on character position. If that is a fixed value that you know, it's easy. If it's not, you can first use the find() function to locate something (like the "_9"), returning the position, and then use the substr() function to pull it off.
    Can you write some pseudo-code here to define exactly your intention? You can set up a dummy script and send a dummy call through using Call Tracer and watch the output to see how your code is working.
    Regards,
    Geoff

  • Simple Task - Syntax Question (how do you pass variables from one component to another component - databinding)?

    Hi all,
    I'm trying to pass some width/height/URLs from a Video Player component to a Social Bookmarking component's embed text input field. (for people to grab and share videos).
    I know this is a simple task, but it's the end of the day and I seem to be having a brain failure... What's the syntax to achieve this? Do I have to import the video player component? These widths/heights/URLs are all being dynamically generated from an XML... should I be pulling it from the XML or just reuse the variables that already exist in the Video Player component?
    Here's my code...
    Video Player:
    [Bindable]
    public var source:String = "";
    [Bindable]
    public var autoPlay:Boolean = false;
    [Bindable]
    public var fullScreenMode:Boolean = false;
    [Bindable]
    public var clipTag:String = "_movie";
    [Bindable]
    public var iag_code:String = "";
    [Bindable]
    public var officialURL:String = "http://www.movies.com/";
    [Bindable]
    public var referer:String = "unknown";
    [Bindable]
    public var gID:String;
    [Bindable]
    public var starterImageURL:String = 'http://www.movies.com/jazzmaster/images/default_starter_image.
    [Bindable]
    public var oldWidth:Number;
    [Bindable]
    public var oldHeight:Number;
    Sharing Component:
    <mx:HBox
      height="10%"
      horizontalCenter="-25"
      verticalCenter="0"
      paddingBottom="5">
      <mx:Text text="Embed Code:" paddingTop="1" color="#FFFFFF" fontSize="12"/>
      <mx:TextInput  text="{oldWidth}"/>
    </mx:HBox>
    The code above throws an error... "Attempted access of inaccessible property oldWidth through a reference with a static type com:SharingBookmarks."
    Thanks all!
    DK

    Try this..
    create a new flex project and add a folder called "src"
    create a new MXML component named "VideoComp.mxml" and copy/paste
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int = 300;
    [Bindable]
    public var videoHeight:int = 300;
    ]]>
    </mx:Script>
    <mx:Label text="Vidoe" />
    <mx:TextInput text="{videoWidth}" id="w" change="this.videoWidth = int(w.text);" />
    <mx:TextInput text="{videoHeight}" id="h" change="this.videoHeight = int(h.text);" />
    </mx:VBox>
    create a new MXML component named, "SharingComp.mxml" add copy/paste this..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int;
    [Bindable]
    public var videoHeight:int;
    ]]>
    </mx:Script>
    <mx:Label text="Sharing Comp." />
    <mx:Label text="{videoWidth}" />
    <mx:Label text="{videoHeight}" />
    </mx:VBox>
    and here is the main.mxml file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:src="src.*">
        <mx:Script>
            <![CDATA[
                private function doSomething():void
                 sharingComp.videoHeight = videoComp.videoHeight;
                 sharingComp.videoWidth = videoComp.videoWidth;
            ]]>
        </mx:Script>
       <src:VideoComp id="videoComp" />
       <mx:Button click="doSomething()" label="copy" />
       <src:SharingComp id="sharingComp" />
    </mx:Application>
    Hope this helps,
    BaBo,

  • Import ASO MAXL syntax question

    I have a maxl script I use to load an ASO database. I realize that I need to have not only the load rule set to append data but the import statement as well. I took the syntax straight from the Essbase documentation but I'm still getting an error. Here's my script:
    alter database App.DB initialize load_buffer with buffer_id 1;
    import database App.DB data from data_file '0947Brand.txt' using server rules_file 'RetailB.rul' to load_buffer with buffer_id 1 on error write to 'RetailB1.err';
    import database App.DB data from load_buffer with buffer_id 1 add values;
    alter database App.DB initialize load_buffer with buffer_id 1;
    import database App.DB data from data_file '0947Generic.txt' using server rules_file 'RetailB.rul' to load_buffer with buffer_id 1 on error write to 'RetailB2.err';
    import database App.DB data from load_buffer with buffer_id 1 add values;
    My error file shows this as an error:
    essmsh error: Parse error near add
    Any ideas?

    Jeanette R. wrote:
    I have a maxl script I use to load an ASO database. I realize that I need to have not only the load rule set to append data but the import statement as well. I took the syntax straight from the Essbase documentation but I'm still getting an error. Here's my script:
    alter database App.DB initialize load_buffer with buffer_id 1;
    import database App.DB data from data_file '0947Brand.txt' using server rules_file 'RetailB.rul' to load_buffer with buffer_id 1 on error write to 'RetailB1.err';
    import database App.DB data from load_buffer with buffer_id 1 add values;
    alter database App.DB initialize load_buffer with buffer_id 1;
    import database App.DB data from data_file '0947Generic.txt' using server rules_file 'RetailB.rul' to load_buffer with buffer_id 1 on error write to 'RetailB2.err';
    import database App.DB data from load_buffer with buffer_id 1 add values;
    My error file shows this as an error:
    essmsh error: Parse error near add
    Any ideas?Not sure of the error, but you are not really using buffers efficiently. You should have a single
    alter database App.DB initialize load_buffer with buffer_id 1;
    then your two import statements
    and finally the
    import database App.DB data from load_buffer with buffer_id 1; statement
    Your actual import statements should have the add values
    When you load multiple files into a buffer at once, it takes and adds the intersections together automatically. you only need the add values if you want to add the values to existing values in the cube.

  • Simple database query syntax question

    Hi experts,
    I am just stucked here...
    e.g.
    String Name = "John Doe";
    String query =
    "select * from table where NameCol = "+Name;
    ResultSet rs =stmt.executeQuery(query);
    while (rs.next()) {
    System.out.println(rs.getString(NameCol);
    The complier complains that "Syntax error !" at
    " NameCol = ....." ?!?!
    Why this is happening ? What is the correct syntax ?
    Thanks in advance !
    Philip

    finally figured it out. thanks...

  • Formatted search with UDF and syntax question

    Can you explain the syntax with when to use the dollar sign and negative in writing a query for a formatted search based on user entry?
    I now want to create a formatted search to pull values based on the user's entry into a UDF on the item master screen.
    User entry into UDF U_Customer Code
    to create Formatted search for UDF U_Rep01
    I tried the following, but it does not work.
    SELECT T0.U_REP01 FROM dbo.OCRD T0
    WHERE T0.CARDCODE = $http://$OITM.U_CUSTOMERCODE
    Thanks.
    Please advise.

    The right syntax would be like this:
    SELECT T0.U_REP01 FROM dbo.OCRD T0
    WHERE T0.CARDCODE = $[OITM.U_CUSTOMERCODE\]
    However, the logic of query may not be correct.  Select something must be already in the system and Where should also be locatable.
    Thanks,
    Gordon

  • Pl/sql function returning query - syntax question

    Hi,
    I'm trying to figure out the syntax for the following query:
    BEGIN
    RETURN 'select name from table1 where name like '%' || :p1_name';
    END;
    It doesn't work because of the single-quotes around the % sign, plus the quotes for the query itself. How can I handle the % sign quotes? Any suggestions would be appreciated!
    Thanks,
    Nora

    Nora,
    If you want to use quotes within a quoted string, you have to duplicate the quotes.
    BEGIN
    RETURN 'select name from table1 where name like ''%'' || :p1_name';
    END;
    Fred.

  • Another syntax question about two dots

    i'd learned that the meaning of " .. " is to access the child nodes in XML.
    but i saw this in source of flex, <mx.skins.halo.RadioButtonIcon.as>
       override protected function updateDisplayList(w:Number, h:Number):void
                 g..beginFill(radioColor);
       where variable g is a graphics object. ordinary, this should be "g.beginFill", i thought.
       now my question is, what does the ".." mean ?
       thank you for any helps.

    I'll ask people I know on the Apache team. I know they code review everything, but it seems to me if they're going to use nonstandard notation they should comment so people know what it means. I don't see any possible way this could be referring to xml, since there is no beginFill method on XML, and hacking the XML object on that scale through prototype would be highly destructive to the codebase.
    Note that just because source is being picked up and shown as the source code doesn't 100% mean that this code was what the swc is compiled from.
    Note that if you try
    import flash.display.Graphics;
    var g:Graphics = graphics;
    g.beginFill(0xFF0000);
    g.drawCircle(100, 100, 100);
    and
    import flash.display.Graphics;
    var g:Graphics = graphics;
    g..beginFill(0xFF0000);
    g..drawCircle(100, 100, 100);
    They both yield the same visual result. My suspicion is maybe this is a shortcut to the GPU.

  • Scalar Variable Syntax questions

    I am practicing Scalar  Variables in a workbook.  Can some help me answer these questions working with Variables.   The Table name is Flights.
    Create and set a Variable equal to the number of Flights that were late.
    Multiply that amount by the amount lost per late flight ($1,029) and store the amount in another variable.
    Take the total amount lost (#4) and subtract it from Total profit ($45,000) and store that number in a variable.
    Find out the Earliest FlightDate and add 10 years to it and store it in a variable.
    Find out the day of the week for the Latest FlightDate and store it in a variable.

    I'm not really sure how you would benefit from we giving the answers to your exercises. How would you learn from that?
    I will only point what I think is a misunderstanding. When they say Create and set a Variable equal to the number of Flights that were late., I think they mean a scalar variable, not a table variable.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • ASO Allocation EXCLUDERANGE syntax question

    am developing an allocation script and need to be able to exclude certain members identified by UDAs from the allocation. When I try to use the UDA function in the excludedrange specification I cannot find a solution to the requirement to have the excluded range statement in double quotes as well as the UDA value. Script is as follows:
    execute allocation process on database app.db with
    pov "Crossjoin({[Final]},
    Crossjoin({[b701]},
    Crossjoin({[c21001]},
    Crossjoin({[i000]},
    Crossjoin({[All Reports]},
    Crossjoin({[All Channels]},{[a41510]})
    amount "[PD08]"
    amountcontext "([l0999],[Act],[2013])"
    target "([Alloc],[PD08],[2013])"
    range "Attribute([Status_Open])"
    excludedrange "UDA([Location], "Exclude_Alloc_1")"
    spread
    Can anyone suggest an escape character combination that might work ?
    Thanks,
    Gavin

    I really don't understand what you are trying to do (may be because you are in 11 version{allocation in ASO cube sounds kool).
    but I can tell you the syntax error you are getting at first line.
    change it to:
    "crossjoin([Year].[FY10],crossjoin([period].[Jan],crossjoin([account].[a111],[Entity].levels(0))))"
    Thanks,
    Jeeth
    Edited by: Jithendra on Oct 14, 2010 5:20 PM

Maybe you are looking for

  • 30', not work with radeon 9800

    Today I got the 30' and plugged it to my PC (old radeon 9800 pro as video card), dvi connection. But after displaying the windows XP logo, the whole screen starts to flash in different colors - right, nothing was displayed but all those colors. Check

  • Error while deploying on WLS 9.2 with OEPE

    I'm getting the following exception while trying to publish a web project onto WebLogic 9.2: <Sep 14, 2009 12:45:30 PM EDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004 weblogic.management.DeploymentException: The system cannot f

  • Problem with creation of a new connection

    Hi all, In a new application,I have created a model.Then I try to create business components from tables,and then a new connection. I can suucessfully create the conection but when I click on ok I got an error like this "Unable to store credential st

  • Fuzzy Lookup Transform not writing to destination

    I'm using MSSQL 2008R2 on a MS Server 2008 R2. I've tried using a flat file, excel, and creating tables to use the Fuzzy Lookup transform. But each time, the source object and Fuzzy Lookup transform turn yellow, but the destination is never reached.

  • Finder Not Showing Album Art

    hey - i'm running a 2011 macbook pro -- i did a software update today (a lot of updates as Lion was recently released), but i HAVE NOT updated to Lion yet (a bit nervous about the bugs and slower performance). my computer no longer shows the album ar