How to Execute  sql query in PL/SQL ( a variable) with out using Cursor or REF cursor

Hi
I am building a dynamic query based on some conditions
as an example
v_query varchar2(2000);
x1 varchar2(20);
y1 varchar2(20);
z1 varchar2(20);
v_query := ' Select x,y,z into x1,y1,z1 From ... ';
Is there any way to execute the query with out using cursor or ref cursor..
Thanks
Arun

Both Tod and Eric provided valid responses given the format of the queory you supplied. Howver, if you want to use dynamic sql in either way, you need to be absolutely certain that your query will always only return a single row (e.g. SELECT COUNT(*) FROM mytable), because if it retuns more than one, your procedure will break unless you have an exception handler to handle either TOO_MANY_ROWS or OTHERS.
If you want to pull in a lot of data without walking a cursor, you should look at the BULK COLLECT options.

Similar Messages

  • How to execute  the CONNECT command in sql

    Hi ,
    I am using DB2 database and I need to execute the sql statement
    CONNECT TO Database user username USING password.
    Can anyone tell me how to execute this query in java.
    I tried this by using executeQuery but it was giving a sexception somtehing as follows
    COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0637E QUERY cannot be found.
         at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwInvalidQueryError(SQLExceptionGenerator.java:577)
         at COM.ibm.db2.jdbc.app.DB2Statement.executeQuery(DB2Statement.java:597)
         at First.detail(First.java:18)
         at First.main(First.java:29)
    can anyone of you help me out in solving this problem

    You need a connection to use JDBC stuff. When you have a connection, you are already logged in. There is no need for a query to connect.

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • Re: How to converting from PL/SQL query to T-SQL query

    How to converting from PL/SQL query to T-SQL query... Its Urgent

    Download the
    SQL Server Migration Assistant for Oracle.  It will convert whole Oracle databases, or single queries or PL/SQL stored procedures.
    With caution that If your database is using Collation which is case sensitive SSMA will not work.SSMA doesnt guarantees 100% for conversion of Queries/stored proc /database if it fails to do so for some queries you will have to do it manually.
    But you can try
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to call a stored procedure on time basis with out using sql job and GOTO

    Hi,
       I wanted to call a stored proc, on time basis ,
    please tel me how it can be done with out using sql job , goto .
    1) That is, is there any timer aviable in sqlserver.
    q2) And which one is better GOTO or sql job.
    yours sincerley

    Raj, Check if my explanation helps you:
    Your job runs every 10 seconds.
    Lets say first time you are scheduling and running your job at 12:00:00 PM
    Now your proc will start executing.
    Say it got finished at 12:00:07.
    Now the next schedule time is 12:00:10 PM.
    The moment this time hits, the job will get invoked and start executing the proc.
    Lets say this time it finished at 12:00:22 PM (It took 2 extra seconds)
    This time the scheduled time is already gone (12:00:20 PM), thus it'll now run at the next schedule that is 12:00:30 PM.
    Thus if anytime your job takes more than 10 seconds to run, it'll just miss those particular schedules overlapping with execution time. Otherwise you are good to go. 
    PS: A job is the best way to handle this, in your problem statement you don't need a job but that would be wrong. You have another way to do that, if you keep running your procedure all the time and the moment your timestamp hits a multiple of 10
    seconds you can run your logic and then returning to the timer. But this is extremely wrong for a system. Even if your requirement is extremely transactional and complex, I would not suggest this. If the job is taking more than 10seconds (which it might if
    your logics inside are complex), you should optimize your code and table architecture.
    Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
    The climb is all there is.

  • Converting cursor to ref cursor in Report builder pl/sql

    Hi,
    I am trying to use dynamic sql in My report 's pl/sql code.
    I can not use execute Immediate statement since this feature is not suppoerted at client side and i am doing the coding In my local mchine and running the report loaclly.......???
    Another way to use dynamic sql is by using dbms_sql package.
    Using dbms_sql to run a sql will give me a normal cursor as an output.
    Since in report builder pl/sql only ref cursor is allowed as a return type from a function........the problem i m facing is conversion of the cursor to ref cursor......
    in oracle 11g we have a built in function in dbms_sql package that can be used for the conversion....
    i m using oracle 10 g where the above mentioned feature is not available............
    Please give some way to resolve this issue............!!!!!!!!!!!!
    Thanks in Advance.....!!!!!!!
    Abhishant

    You may use some stored procedures that will take full advantage of dynamic SQL. Make a stored proc that inserts rows in a global temporary table. You will call that stored proc in the afterpform trigger. And you will have the report querry select from the temporary table populated by the stored proc.
    I did some things like that.
    HTH

  • )How can we schedule the info package daily run at 6 AM, with out useing in

    Hi
       Can any one explain 1) what is information broadcasting &how can we use this.
    2)What are the settings we have to do when we use the charts in WAD's
    3)How can we schedule the info package daily run at 6 AM, with out useing in process chains
    Thanks
    Bharath

    Hi,
      Information broadcaster :
          you can precalculate and distribute(thru mail) the query, workbook and webtemplate through online link or html file to the receipents (users).
    have a look at the below link.
         http://help.sap.com/saphelp_nw04/helpdata/en/3a/0e044017355c0ce10000000a1550b0/frameset.htm
    Infopackage scheduling:
         you can schedule the infopackage daily at your desired time .In the schedule tab ,select the start later in background and in the scheduling option give the date and time and give the period values as daily.
    Regards,
    Siva.

  • How do I view ipod music files with out using I tunes?

    I trying to view my Ipod music files without using itunes. But when I conect my Ipod to my pc I can only view contacts, notes, and caladar through the driver.
    How do I view ipod music files with out using I tunes?

    they should be under ur my music folder if u have windows

  • How can i get new apple id with out using credit card or visa card

    how can i get a new apple id with out using credit card or visa card?

    Hi xianlycier06,
    If you are looking to create an Apple ID without using a credit card, you may find the following article helpful:
    Apple Support: Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
    http://support.apple.com/kb/HT2534
    Regards,
    - Brenden

  • I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me

    I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me

    Here's a quick example I threw together that generates a sort-of-bell-curve shaped data distribution, then performs the binning and plotting.
    -Kevin P.
    Message Edited by Kevin Price on 12-01-2006 02:42 PM
    Attachments:
    Binning example.vi ‏51 KB
    Binning example.png ‏12 KB

  • How to add an attachment to an e-mail. With out it showing  up and the end of a e-mail.

    How to add an attachment to a e-mail. With out it showing up at the end of the e-mail.

    https://discussions.apple.com/message/17397882#17397882
    How can I prevent mail attachments embedding when sending mail
    Note there are 14 pages of replies

  • How to cast vector to vector with out using loop. and how to override "operator =" of vector for this kind of condition.

    Hi All How to TypeCast in vector<>...  typedef  struct ...  to class... 
    //how to cast the vector to vector cast with out using loop
    // is there any way?
    //================ This is Type Definition for the class of ClsMytype=====================
    typedef struct tagClsMytype
    CString m_Name;
    int m_Index;
    double m_Value;
    } xClsMytype;
    //================ End of Type Definition for the class of ClsMytype=====================
    class ClsMytype : public CObject
    public:
    ClsMytype(); // Constructor
    virtual ~ClsMytype(); // Distructor
    ClsMytype(const ClsMytype &e);//Copy Constructor
    // =========================================
    DECLARE_SERIAL(ClsMytype)
    virtual void Serialize(CArchive& ar); /// Serialize
    ClsMytype& operator=( const ClsMytype &e); //= operator for class
    xClsMytype GetType(); // return the typedef struct of an object
    ClsMytype& operator=( const xClsMytype &e);// = operator to use typedef struct
    ClsMytype* operator->() { return this;};
    operator ClsMytype*() { return this; };
    //public veriable decleare
    public:
    CString m_Name;
    int m_Index;
    double m_Value;
    typedef struct tagClsMyTypeCollection
    vector <xClsMytype> m_t_Col;
    } xClsMyTypeCollection;
    class ClsMyTypeCollection : public CObject
    public:
    ClsMyTypeCollection(); // Constructor
    virtual ~ClsMyTypeCollection(); // Distructor
    ClsMyTypeCollection(const ClsMyTypeCollection &e);//Copy Constructor
    DECLARE_SERIAL(ClsMyTypeCollection)
    virtual void Serialize(CArchive& ar);
    xClsMyTypeCollection GetType();
    ClsMyTypeCollection& operator=( const xClsMyTypeCollection &e);
    ClsMyTypeCollection& operator=( const ClsMyTypeCollection &e); //= operator for class
    void Init(); // init all object
    CString ToString(); // to convert value to string for the display or message proposed
    ClsMyTypeCollection* operator->() { return this;}; // operator pointer to ->
    operator ClsMyTypeCollection*() {return this;};
    public:
    vector <ClsMytype> m_t_Col;
    //private veriable decleare
    private:
    //===================================================
    ClsMytype& ClsMytype::operator=( const xClsMytype &e )
    this->m_Name= e.m_Name;
    this->m_Index= e.m_Index;
    this->m_Value= e.m_Value;
    return (*this);
    //==========================Problem for the vector to vector cast
    ClsMyTypeCollection& ClsMyTypeCollection::operator=( const xClsMyTypeCollection &e )
    this->m_t_Col= (vector<ClsMytype>)e.m_t_Col; // how to cast
    return (*this);
    Thanks in Advance

    Hi Smirt
    You could do:
    ClsMyTypeCollection* operator->() {
    returnthis;};
    // operator pointer to ->
    operatorClsMyTypeCollection*()
    {returnthis;};
    public:
    vector<ClsMytype>
    m_t_Col;//??
    The last line with "vector<xClsMytype>
    m_t_Col;". It compiles but I doubt that is what you want.
    Regards
    Chong

  • How to get the line in the template (smartform) with out using under score

    Hi,
         How to get the line in the template (smartform) with out using under score,
         and how to print the box (line the check box - small squre box (which is used ot mark the tick by the user in front of the item).
         Please provide the valueble answer as early as possible.
    Thanks,
    Ravi

    Hi Ravi,
    Line -
    Use a SMATSTYLE for this purpose.in the smartstyle create a paragraph or character with underline atribute.Then call the smartstyle in the text.
    Search SDN with Key <b>UNDERSCORE</b>.. will get few more posts on the same.
    For Checkbox - refer link
    Re: Quick Question on Smartforms
    Re: putting tick mark into check box in smartform
    Reward points if this Helps.
    Manish
    Message was edited by:
            Manish Kumar

  • How To Split File In to Multiple Files With out using B.P.M

    Hi Guys,
    How To Split File In to Multiple Files With out using B.P.M.
    Thanks in advance
    Regards's
    KIran.B

    Hello
    below r the links were u will find message spilitting by graphicaaly i.e without using BPM.
    /people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
    Sender File Adapter with file conversion  Multimapping --file content conversion with split messg mapping
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2748---- [original link is broken] [original link is broken] [original link is broken]
    multimappig
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    hope this resolve your problem
    thank's
    Chetan

  • How to print a string with out using main method??

    how to print a string with out using main method??
    if we can tell me with example?
    thanks in adavance
    raja

    Hi,
    actually there's none. The UITableView class needs to "know" the tableView's height so either it can calc <number of rows> times <row height> or it has to sum the height of each single row.
    If the row which needs to be of different size always is the first or the last row you can user a tableHeader or tableFoot view.
    Regards
    Dirk

Maybe you are looking for

  • HELP!  QT Icon bounces once, then nothing

    When I click on my QT icon in the task bar, it bounces once and then nothing happens. QT fails to load. Anyone ever experience this and what the **** can I do to fix it? Thanks! Allen

  • Sender file adapter - Can I use *.xml for the file name

    Hi Gurus, I have some interfaces where I need to pick the file from a directory. The name of the file will have Data<i>time stamp</i> as the naming convention. Can I use *.xml to pick up my files from this directory? The help.sap.com documentation sa

  • Using JDBC with Oracle

    I have just completed compiling and running a simple UI through a java command line interface, however part of my program is running into a problem. I have to connect to Oracle through JDBC, but the server I am not on does not have the oracle drivers

  • Port addressing and restricted MACs to a port Cisco Catalyst 1900

    Hi, to everyone I want to ask if there is a method or documentation to guide me throught to give restricted mac or macs to a port via snmp. What are the OIDs and method? Any information would be helpful. Thanks in advance.

  • The CS6 trial version converted ALL my InDesign files to CS6!!

    The CS6 trial version converted ALL my InDesign files to CS6!!  Is there any way to get them all back to CS5.  Right now I'm incompatable with everyone I work with.  I don't want to save every file back to .IDMl when working with vendors and other de