Dynamic For loop in Oracle 10g

Hi ,
my requirement is to write dynamic for loop , Some thing similar to below plsql block, But I am getting error , please suggest
declare
lv_text varchar2(200);
begin
lv_text:='select * from some_table ';
for i in (lv_text)
loop
null;
end loop;
end;
**** Here my purpose of lv_text is to use a dynamic query in for loop.

You are getting error because lv_Text is not a cursor variable.... So you can try this way..if your statement is known...
begin
For rec in (select * from emp)
loop
dbms_output.put_line(rec.ename);
end loop;
end;
Or try this if your statements can be controlled based on your addition input(cnt)
create or replace procedure p_ref_Cursor
+(p_Empno in number,p_ename out varchar2,p_sal out number,cnt number)+
is
Type ref_cursor is ref cursor;
e_ref_Cursor ref_Cursor;
begin
if cnt =1 then
open e_Ref_Cursor for select ename from emp where empno=p_Empno;
fetch e_ref_cursor into p_ename;
else
open e_Ref_Cursor for select sal from emp where empno=p_Empno;
fetch e_ref_cursor into p_sal;
end if;
close e_ref_cursor;
end;
or Use dbms_sql package for creating dynamic SQL as suggested by others too if your statement is completely dynamic ..:)

Similar Messages

  • Can cold backup be taken for ASM managed oracle 10g databases

    Can cold backup be taken for ASM managed oracle 10g databases
    Pls help

    do we still need to take cold backupYou need to take backup. Hot or cold depends on how your DB is running (archivelog or not).
    Will we have file permisions for copyng Use RMAN and don't worry about that.

  • Problems using Quick Migrate in SQL Developer 1.5 for MySQL to Oracle 10g

    Hi all,
    I am trying to use SQL Developer 1.5 migration tools (Quick Migrate) to perform online capture and build source model to migrate from MySQL 5.x to Oracle 10g on Windows platform. I get these errors and the Quick Migrate process fails:
    oracle.dbtools.metadata.persistence.PersistableObject.doInsert(PersistableObject.java:238)
    I did a search and used the sqldeveloper.cmd script but still fails. Then I created a new database and truncated the repository. I now get the above error plus two new ones listed below:
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    Error loading nls:OALL8 is in an inconsistent state
    Error occurred during capture: Protocol violation
    It fails during the capture process for MySQL 5.1 database
    when it begins to capture the tables from MySQL.
    Does anyone know how to resolve these issues when migrating from MySQL to Oracle 10g using Quick Migrate with SQL Developer 1.5 release?
    Regards,
    Ben Prusinski
    Message was edited by:
    benprusinski
    Message was edited by:
    benprusinski

    Hi all,
    I put the following in my sqldeveloper.cmd file:
    SET ORACLE_HOME=%CD%
    What is very confusing is that with SQL Developer 1.5, there are several levels and several SQL Developer executables! I am really not sure which of these to use:
    I created the SQLDeveloper 1.5 directory called SQLDeveloper1_5 on Windows:
    1) cd C:\sqldeveloper1_5\sqldeveloper-5338
    there exists a sqldeveloper.exe
    2) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper.exe
    3) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloer\bin\sqldeveloper.exe
    Which SQLDeveloper 1.5 executable should I be using and where should I place the
    sqldeveloper.cmd file?
    Also I did try to use a different database and schema for the repository with Quick Migrate but it appears a bug exists in SQL Developer 1.5 version that causes errors with Quick Migrate for MySQL to Oracle? Is this correct?
    As an update, I ran the following commands:
    cd to
    c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper\bin
    sqldeveloper.cmd sqldeveloper.exe
    Start sqldeveloper.exe
    Perform standard capture for MySQL using the new mig2 schema as the new repository
    It starts the capture but fails on the errors below:
    Error loading nls:OALL8 is in an inconsistent state
    UPDATE
    ============================
    I tried this again and it worked with the exception of one error message listed below:
    Here are the steps that I followed:
    1. Create a Windows cmd script
    Put the following entries in the script:
    SET ORACLE_HOME=%CD%
    save the command windows script as sqldeveloper.cmd
    Copy this script to the base installation directory for SQLDeveloper
    Example:
    1. cd c:\SQLDeveloper1_5\sqldeveloper-5338\sqldeveloper
    2. Start SQLDeveloper with the command script that you created earlier
    Example:
    Open a Windows shell prompt window and execute the following scripts:
    a) sqldeveloper.cmd sqldeveloper.exe
    b) sqldeveloper.exe
    3) In SQL Developer 1.5
    From the Migrate menu,
    a) Delete current repository and create a new schema in Oracle target database call it mig2.
    b) Then create a new repository in SQL Developer 1.5
    c) Right mouse click on the MySQL 5.x database and choose capture
    It worked with the exception of one error message:
    o.jdbc.driver.OracleDriver     
    Error while registering Oracle JDBC Diagnosability MBean.
    So it looks like something is screwed up with my JDBC drivers and configuration for MySQL. How do I diagnose the JDBC driver issue for MySQL?
    Thanks!!!
    Ben
    Thanks
    Ben

  • Can I disable logging for session in Oracle 10g?

    I use a procedure to delete a lot of row for an application repeatedly. Because the DELETE statement is time consuming and the data don't need to be archived, I decide to use the nologging option.
    How to do it?
    What is the best choice? Can I disable logging from session in Oracle 10g?
    Thank you
    Edited by: jetq on Jul 23, 2009 9:46 AM

    Hi,
    "Delete" without generating redo-log is not possible.
    If you are on 10g, one way of making this thing efficiant is partition the table, with range-list partitioning. Partitioning existing table will be an excercise in itself, but that will be one time activity.
    In partitioned (or sub-partitioned) tables, you can truncate a partition (or subpartition). That won't generate any redo log (or very very less redo log) and that runs in seconds.
    In your case if you range partition INCOMING table by datetime (1 partition per day) and list sub-partition it by STATUS, that would help.
    Another approach is, if you are deleteing, say 80% records every day and leaving 20% (or very less) records. What you can do is, partition the table only by range on datetime. Then, every time you want to delete data, copy the rows you want to keep in some other table (or temporary table), truncate partition for that day and insert rows back (which you want to keep).
    I have done a similar thing and it works very quickly and generates very less redo log. Redo log generated in case of truncating partition or creating new partitions is just for Oracle internal commands (like data dictionary update etc).
    Have fun.

  • Best Practices for deployment of Oracle 10g database.

    Hello ,
    Is anyone aware of a whitepaper/ document that talks about best pratices in deploying a database on Oracle 10g and configuration of the database to utilize all the features available in 10g ( eg. ADDM , reports setup etc )
    Thanking you in Advance.
    Cheers..rCube

    Appreciate the input Jaffer. Thanks.
    However I was referring to a Best Practices whitepaper like the one existing for Data Guard & MAA available at the follwogng url : - http://www.oracle.com/technology/deploy/availability/htdocs/maa.htm
    Is there something available along the same lines ?
    Cheers..rCube

  • Dynamic rows to columns oracle 10g

    Hi,
    I'm using oracle 10g. I have a requiriement where I need to show rows to columns. I have read through many posts but I couldn't find what I wanted to solve. Lots of them are using decode, since they know the values in one column.
    My table has name, value and date. I need to get values for each name at certain date (each distinct date needs to become column). I don't know the name beforehand.
    Name, Value, Date
    T1 100 06-27-2011 09:00:00
    T2 100 06-27-2011 09:00:00
    T1 200 06-27-2011 09:15:00
    T2 150 06-27-2011 09:15:00
    I would also need to use a date range. Someone can request date between 09:00:00 and 09:05:00 or 09:00:00 and 09:30:00 etc.
    I need to print
    Name, 06-27-2011 09:00:00, 06-27-2011 09:15:00
    T1 100 200
    T2 100 150
    Appreciate any advice on this.
    Edited by: user8801143 on 28-Jun-2011 08:23

    With 10g
    see http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766825833740#2989343200346664698
    search for post on February 11, 2011 and reply on February 14, 2011
    with 11g see the pivot clause

  • XWindows client for Redhat EL5/Oracle 10g

    I am trying to install Solman 4.0 on to a Redhat EL5/Oracle 10g platform but the sapinst screen does not refresh when we move through the installation.  The xwindows client is CYGWIN and is running on a WinXP workstation.
    Has anyone else experienced this and what did you do to fix it?  May this be because of a problem with the xwindows client?  If so can someone recommend a shareware xwindows client to use?  We are currently at the most recent version for sapinst so I cannot patch that.
    Steve

    I know this effect with cygwin/X.
    I see several options:
    1. Resize the window everytime an update was made, then the window will be repainted. That's annoying, but it works.
    2. install sapinst locally on your WinXP and start sapinst in server mode.
    3. try another XServer like XDeep/32 or X-Win32
    Norbert

  • Specify File Encoding(Japanese Characters) for UTL_FILE in Oracle 10g

    Hi All,
    I am creating a text file using the UTL_FILE package. The database is Oracle 10G and the charset of DB is UTF-8.
    The file is created on the DB Server machine itself which is a Windows 2003 machine with Japanese OS. Further, some tables contain Japanese characters which I need to write to the file.
    When these Japanese characters are written to the text file they occupy 3 bytes instead of 1 and distort the format of the file, I need to stick to.
    Can somebody suggest, is there a way to write the Japanese character in 1 byte or change the encoding of the file type to something else viz. ShiftJIS etc.
    Thanking in advance,
    Regards,
    Tushar

    Are you using the UTL_FILE.FOPEN_NCHAR function to open the files?
    Cheers, APC

  • PCTFREE setting for index in Oracle 10g R2

    Is PCTFREE parameter obsolete in oracle 10g R2? I don't see any reference to this paramerer in oracle documentation:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231.pdf
    But 10g R 1 does mention about this setting.
    http://support.cs.nott.ac.uk/help/docs/databases/oracle/standard/server.101/b10739.pdf
    We are still using Dictionary Managed tablespaces on 10.2.0.3. Can we ignore this parameter on 10g R2 ?
    Thank You

    PCTFREE is still relevent even in ASSM. (that you are using DMT means that you are not using ASSM, but LMT could be MSSM !)
    I couldn't find PCTFREE in the Administrator's Guide but it is still very much present in the SQL Reference
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses007.htm#g1058547
    and a couple of references in the Performance Tuning Guide.

  • Re:The requirements for installing the Oracle 10g

    Hi
    I wish to install Oracle 10g on a Laptop(Pentium 4 AND 512 Mb Ram).
    Is this configuration enough?

    The following link should provide useful information.
    http://download-east.oracle.com/docs/html/B10130_02/reqs.htm#i1005703

  • Cursor for loop in  oracle forms 6i

    Hi all,
           I have written code in the find button to display deptno=10 employees ,in TOAD it worked fine, but why it is not worked in the form find button? Please suggest? I added below i am getting all records? , I want only related employees records..
    BEGIN
        FOR e_cursor  IN ( SELECT ename  FROM emp where deptno=10 ) LOOP
          dbms_output.put_line( e_cursor.ename );
        END LOOP;
        --EXECUTE_QUERY;
    END;
    Thank You

    Christian Erlinger wrote:
    dbms_output will do exactly nothing in forms, as forms won't get the output buffer like toad or sqlplus does. Besides that I am guessing you have a basetableblock basing on your emp table? The easiest way would be to add a where clause programmatically to your block using set_block_property. No cursor needed at all.
    cheers
    Message was edited by: Christian Erlinger
    Yes i have basetable block basing on emp table.
    Could you please give an example on this please?

  • Pivot Dynamic for Query in Oracle SQL DEVELOPER ??

    Hi
    I have the following question, someone who has a dynamic pivot.
    I need a dynamic query that is that when the transfer column to row do receiving any type declared as these can change data.
    Example:
    ID_PROJECT
    PROJECT STAGES
    DATE
    12345
    Requirement Analysis
    17-01-2013
    12345
    Quotation
    20-01-2013
    12345
    Project Preparation
    29-01-2013
    12345
    Model Verification
    04-02-2013
    12345
    Closed requirement
    10-02-2013
    23456
    Building and Unit Tests
    With dynamic pivot:
    ID_PROJECT
    Requirement Analysis
    Quotation
    Project Preparation
    Model Verification
    Closed requirement
    12345
    17-01-2013
    20-01-2013
    29-01-2013
    04-02-2013
    10-02-2013
    I mean that in this case the stages of the project will be changing.

    Hello,
    Do you want to do this in an SQL - Developer application-setting or by using any SQL / PLSQL block or both ?

  • How to alter value for processes in Oracle 10g XE

    Im installing weblogic server 11g. Im getting the error
    RCU-6083:Failed - Check prerequisites requirement for selected component:SOAINFRA
    Please refer to RCU log at C:\stageSOA\rcuHome\rcu\log\logdir.2010-06-18_17-04\rcu.log for details.
    RCU-6107:DB Init Param Prerequisite failure for: processes
    Current Value is 40. It should be greater than or equal to 200.
    RCU-6092:Component Selection validation failed. Please refer to log at C:\stageSOA\rcuHome\rcu\log\logdir.2010-06-18_17-04\rcu.log for details.
    I have read in a forum this this command will work
    alter system set Processes=300 scope=spfile;
    where should I write this command. I have tried the SQL command line. But it says its invalid

    One thing I detected here as a bad practice, you blindly issued the command "ALTER SYSTEM ... SCOPE=SPFILE" and later on you asked why you were not able to see the change.
    It lets me know that you applied a change without even bothering to find out what it was about. Please make sure next time you blindly apply a command this doesn't start with "DROP ...." or you may face a hard time.
    ~ Madrid
    http://hrivera99.blogspot.com

  • Multiple endpoints for HTTP adapter (OracleAS 10g - 10.1.2)

    The HTTP adapter documentation states the HTTP adapter supports sending outgoing messages for Interconnect to multiple HTTP endpoints. This enables sending messages to various remote web servers.
    The HTTP user guide states:
    "An endpoint is associated with a subscribing event in iStudio by adding the transport properties such as the HTTP endpoint as metadata for the event. This is done using the Modify Fields function of the Subscribe Wizard - Define Application View dialog. After associating an endpoint and event, the message from the subscribing event is sent to the HTTP endpoint.
    When using the multiple endpoint feature with XML data type, use the Generic event type, instead of XML. Using the Generic event type allows you to enter the metadata for the endpoints using the Modify Fields feature associated with iStudio.
    When invoking this through iStudio, the screen allows you a name/value pair and I have entered 'multipleEP' for the name & 'http://....servlet' for the value. Is this the correct way? For an additional endpoint I assume I add another name/value pair in a similar way to above, can someone confirm this method?
    Some confirmation or additional HOWTO documentation on this facility would be appreciated.
    Regards,
    David

    I've done a bit of testing and this is what I found. Feel free to expand as you see fit.
    Using the Modify Fields feature allows you to enter name/value pairs. I found that you enter the metadata parameter in the name, and the metadata value in the value. For example:
    Name - ota.endpoint, Value - createMemoEP (appears to arbitrary but my example is related to event crateMemo)
    Name - ota.send.endpoint, Value - http://..../servlet/yourServlet
    The data gets saved in table EMDDATALET and when used by the adapter, the above information overrides the metadata from the adapter.ini file.
    Hopes this helps anyone who wants to use this facility.
    David

  • File Need for Oracle 10g AS from Oracle 10g Jdeveloper

    Dear All,
    I have completed my application for running on Oracle 10g AS.
    What files and the structure that I should maintenace/ keep
    without having all file and structure like what we have in oracle
    10g J developer on Mywork folder?
    Help me ..please...
    regards
    erie

    Erie,
    if you are deploying to Oracle Application Server 10g (9.0.4) or higher, then you don't need to deploy the ADF runtime libraries because they are already there.
    If you create a deployment profile for the application you want to deploy - e.g. a WAR file or EAR file deployment - then you can select the files you want to deploy. The default settings typically include all teh necessary files.
    Frank

Maybe you are looking for

  • Look for suggestion on file encrytion and database

    Hi all,   I am developing a CVI and need to store some critical data (some parameters like device name and some critical constants) to a encrypted file. There are about 100 parameters need to be stored, total size is about 1kb. I was thinking to stor

  • Iphoto wont open - library not loaded

    I recently had an issue where both Aperture and iphoto couldn't load, the message said "iphoto cannot be opened because of a problem" and then I got the error message below. It didn't even load the app, but bounce it once and then post the error mess

  • Upgrader to Version 1.0.2

    Hello. I am upgrade my program to java version 1.0.2 but am finding still the error of date only working with 1970 between 2037. Other date not work???

  • Publishing Event Video to HTML5 ?

    I have inserted an event video into a slide and uploaded an mp4 file.  When publishing the project and viewing it in a web broswer, the HTML5 output does not allow for any video controls, and as such the video does not play. I cannot publish the vide

  • DVD Audio- I want sound from sides, not r

    Is there any way to reconfigure so that surround sound from dvdaudio comes out of the side speakers instead of the rear when using a 7. setup?