Plsql index

Hi,
I have the below code. Please let me know why i am getting bdms error.
emp table has only one column- idd
insert into emp
values( 1)
declare
type emptabtype is table of emp%rowtype index by pls_integer;
empTab emptabtype;
begin
select * into empTab(1)
from emp
where idd = 1;
DBMS_OUTPUT.PUT_LINE( empTab(1));
end;
[Error] Execution (11: 1): ORA-06550: line 11, column 1:
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
ORA-06550: line 11, column 1:
PL/SQL: Statement ignored

user543623 wrote:
I have the below code. Please let me know why i am getting bdms error.Simply because DBMS_OUTPUT.put_line() has a single VARCHAR2 argument.
In other words, it expects a string value to be passed.
You are passing what as an argument? An emp%rowtype data structure. This is obviously not a string.
The PL/SQL engine supports implicit data type conversion. So if a parameter needs to be of one data type and the you pass another data type value, it attempts to convert what you have supplied into the data type expected.
However, there is no data type conversion feature that changes a data record structure into a string.
Also - you do NOT need an associative array as collection data type. That is silly. Use a normal array instead.

Similar Messages

  • A way to bind PLSQL indexed tables to ResultSets???

    Hello All,
    I got a stored procedure that returns several PLSQL indexed tables. Instead of handling them as separate arrays, I'd like to combine all of them as one resultset. Is that possible? Here is a sample code of what I'm trying to do:
    // Parameters 5 and 6 return PLSQL indexed tables of varchar
    OracleCallableStatement cmd = (OracleCallableStatement )cn.prepareCall(" begin PKG_MY_TEST.MY_TEST(?,?,?,?,?,?); end;");
    cmd.registerOutParameter(1, Types.NUMERIC, 8);
    cmd.registerOutParameter(2, Types.VARCHAR, 500);
    cmd.registerOutParameter(3, Types.VARCHAR, 30);
    cmd.registerOutParameter(4, Types.VARCHAR, 32);
    cmd.registerIndexTableOutParameter(5, 100, Types.VARCHAR, 32);
    cmd.registerIndexTableOutParameter(6, 100, Types.VARCHAR, 32);
    cmd.execute();
    String[] arr1 = (String[]) cmd.getPlsqlIndexTable(5);
    String[] arr2 = (String[]) cmd.getPlsqlIndexTable(6);
    // I have two string arrays. Can I make one resultset out of them?
    Thanks in advance!
    null

    Hello All,
    I got a stored procedure that returns several PLSQL indexed tables. Instead of handling them as separate arrays, I'd like to combine all of them as one resultset. Is that possible? Here is a sample code of what I'm trying to do:
    // Parameters 5 and 6 return PLSQL indexed tables of varchar
    OracleCallableStatement cmd = (OracleCallableStatement )cn.prepareCall(" begin PKG_MY_TEST.MY_TEST(?,?,?,?,?,?); end;");
    cmd.registerOutParameter(1, Types.NUMERIC, 8);
    cmd.registerOutParameter(2, Types.VARCHAR, 500);
    cmd.registerOutParameter(3, Types.VARCHAR, 30);
    cmd.registerOutParameter(4, Types.VARCHAR, 32);
    cmd.registerIndexTableOutParameter(5, 100, Types.VARCHAR, 32);
    cmd.registerIndexTableOutParameter(6, 100, Types.VARCHAR, 32);
    cmd.execute();
    String[] arr1 = (String[]) cmd.getPlsqlIndexTable(5);
    String[] arr2 = (String[]) cmd.getPlsqlIndexTable(6);
    // I have two string arrays. Can I make one resultset out of them?
    Thanks in advance!
    null

  • Oracle Database 10g JDBC Samples on OTN

    Review the OTN's new Oracle Database 10g JDBC Samples that illustrate new features introduced with Oracle10g JDBC Driver. The features illustrated are Connection Cache, Named Parameter Support, IEEE Datatypes, Thin Driver support for PLSQL Index by Tables and Web Rowset. Also watch out for samples on Datalinks, New Encryption Algorithms, Globalization Support, Shortcuts for CLOB manipulation and more to be hosted shortly.
    The samples are available at,
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/oracle10g/index.html

    I suppose that is nice.
    It would be even nicer if the drivers actually conformed to JDBC so that one could for example reliably use blobs in a J2EE server with CMP.

  • Publish PL/SQL with Web Service with errors ...

    Good day, I installed on my pc the example of the following link:
    http://www.oracle.com/technology/tech/webservices/htdocs/series/plsql/index.html
    Unfortunately, when try to perform it on the window where running Oracle9iAS comes restored the following mistake :
    Node started with id=-1716454166
    Oracle9iAS (9.0.3.0.0) Containers for J2EE initialized
    java.lang.NullPointerException
    at oracle.jdbc.driver.LRUStatementCache.searchExplicitCache(LRUStatement
    Cache.java:654)
    at oracle.jdbc.driver.OracleConnection.getStatementWithKey(OracleConnect
    ion.java:4347)
    at sqlj.runtime.ExecutionContext$OracleContext.prepareOracleStatement(Ex
    ecutionContext.java:1397)
    at rocco.Company.addemp(Company.sqlj:42)
    at rocco.__CompanySPWrapper.invokeMethod(__CompanySPWrapper.java:73)
    at oracle.j2ee.ws.InvocationWrapper.invoke(InvocationWrapper.java:108)
    at oracle.j2ee.ws.RpcWebService.doPost(RpcWebService.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterC
    hain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
    stDispatcher.java:560)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
    vletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
    tHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:106)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
    utor.java:797)
    at java.lang.Thread.run(Unknown Source)
    and on the JDeveloper window show the mistake:
    C:\jdev\jdk\bin\javaw.exe -ojvm -classpath C:\jdev project\PLSQL\Project1\classes;C:\jdev\jdev\lib\jdev-rt.jar;C:\jdev\sqlj\lib\runtime12.jar;C:\jdev\jdbc\lib\classes12.jar;C:\jdev\jdbc\lib\nls_charset12.jar;C:\jdev\jdev\lib\jdev-rt.jar;C:\jdev\soap\lib\soap.jar;C:\jdev\lib\xmlparserv2.jar;C:\jdev\jlib\javax-ssl-1_2.jar;C:\jdev\jlib\jssl-1_2.jar;C:\jdev\j2ee\home\lib\activation.jar;C:\jdev\j2ee\home\lib\mail.jar;C:\jdev\j2ee\home\lib\http_client.jar mypackage1.RoccoCompanyWebServiceStub
    [SOAPException: faultCode=SOAP-ENV:Server; msg=[SOAPException: faultCode=SOAP-ENV:Server; msg=]]
         void mypackage1.RoccoCompanyWebServiceStub.addemp(rocco.Employee)
              RoccoCompanyWebServiceStub.java:164
         void mypackage1.RoccoCompanyWebServiceStub.main(java.lang.String[])
              RoccoCompanyWebServiceStub.java:59
    Process exited with exit code 0.
    It seems been depicted all correctly, but although this do not succeed to complete the tutorial with the test puts into practice.
    Someone it is able to be me of help.
    Thanks one thousand.
    :-(

    Hi,
    there is a tutorial:
    http://www.oracle.com/technology/obe/obe1013jdev/10131/wsfromplsqlpackage/devwsfrom%20plsql.htm
    "Developing a Web Service from a PL/SQL Package"
    I think you need Oracle AS, because you need an instance which "talks" http....

  • Oracle 9i Webservices app with SOAP interface?

    I'm building an app that has the basic requirement of providing a SOAP interface. Originally this was planned to be a full blown J2EE solution, but I've begun to question the need for all that complexity.
    Is there a way to provide the SOAP interface using some variation of OAS components? What is the minimum I need? Does java have to be part of the equation or can I simply connect the SOAP interface to some stored procs?
    Although I have used Oracle database server to develope many applications over the years, I've never made use of OAS and am fairly confused by all the different components and exactly what they do. TIA

    With Oracle JDeveloper you can publish PL/SQL Stored Procedures as Web Services.
    You don't have to write your business logic in Java.
    Check out more information about it at :
    http://otn.oracle.com/tech/webservices/htdocs/series/plsql/index.html
    and
    http://otn.oracle.com/tech/webservices/database.html

  • JDBC- passing array of integer to StoredProcedure

    I want to pass an array of integer(JAVA) to stored procedure and read it in the stored procedure. Is it possible ?
    I need the sample JAVA code and the Stored Procedure too.

    Rajganesh,
    This is currently not supported. A workaround is to use Oracle Collection types.
    Simple scalar arrays will be supported by the upcoming 8.1.7 JDBC OCI driver provided that your stored procedure takes PLSQL index-by table arguments.
    Thanks.

  • Expose Table as Webservice

    I am trying to create a internal web service that will return a recordset based on filter.
    Platform JDev 10g
    1. Made Database connection.
    2. Created new application. (JSP, Struts, EJB)
    3. Created Model Diagram. (Which Diagram should I create.)
    If I choose web service Diagram I cannot drop my table view onto diagram.
    4. ? using When I drag the Table onto the Diagram. Do I create a EJB or Java Class. I ask this because only Java Classes can be made into WS.
    What steps do I need to take to expose a table as a webservice???

    Eric,
    You can't publish a table as a web service directly,
    You'll need some code that access the table and then you'll publish this code as a Web service.
    The code can be a simple Java class doing JDBC calls, a BC4J component, and EJB or even a PL/SQL stored procedure that you publish as a web service.
    Here are some tutorials that might help:
    For PL/SQL
    http://otn.oracle.com/tech/webservices/htdocs/series/plsql/index.html
    For BC4J
    http://otn.oracle.com/tech/webservices/htdocs/series/pattern/
    for EJB
    http://otn.oracle.com/tech/java/oc4j/1003/how_to/how-to-ws-ejb21.html
    More on http://otn.oracle.com/tech/webservices

  • Missing Technet Video - Publish PL/SQL as a Web Service

    When I try to view the video for "Publish PL/SQL as a Web Service" (http://www.oracle.com/technology/tech/webservices/htdocs/series/plsql/index.html) I get an invalid URL message from Real Player.
    Is this video no longer available?

    Sorry; that content is no longer available. For a more recent document we suggest this URL:
    http://www.oracle.com/technology/pub/articles/price_10gws.html
    Cheers, OTN

  • Why so many broken links under otn regarding db web services????

    on this page
    http://www.oracle.com/technology/sample_code/tech/java/jsp/dbwebservices.html
    these are broken:
    1. Oralce 9i database web services
    http://www.oracle.com/technology/tech/webservices/htdocs/dbwebservices/Database_Web_Services.pdf
    2. Basic Web service Call-out using PL/SQL UTL_HTTP
    http://www.oracle.com/technology/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
    3. Publish PLSQL as a web service using JDEveloper
    http://www.oracle.com/technology/tech/webservices/htdocs/series/plsql/index.html
    4. Use Oracle 9iAQ with JMS for Web Services
    http://www.oracle.com/technology/tech/webservices/htdocs/series/jms/
    (so EVERY Tutorial results in a 404)

    two of the links at the bottom of this page are broken:
    http://www.oracle.com/technology/products/jdev/howtos/10g/WS_LoadJava/LoadJava_HowTo.html

  • Generating PL/SQL web service

    Trying to create a webservice from a PL/SQL package, using the wizard in JDeveloper (10.1.2 build 1811), I encounter an error message: "The package you have chosen is listed as invalid". After checking this in the database the package does not appear to be invalid to me...
    Could it be that the user i am using to connect to the database is not the owner of the package? The message does not appear when I have the web service refer to a package which is owned by the user, I use to connect to the database.
    Any other ideas/ solutions?

    Hi ,
    I did not try the command line approach. I could try it as well - could let me know if there is any link . I tried following the command line available in PlSQL web service column by Jason Price , there was not able to locate config.xml.
    I just went on configuring as per instructions given at below link..... I'm using the example source available (plsql1.zip) in the example at this link itself.
    Colum : "Publish PL/SQL as Web Service" ( http://www.oracle.com/technology/tech/webservices/htdocs/series/plsql/index.html )
    Thanks,
    Ajay

  • Java, PLSQL table index

    Hello,
    when I call from a java program a plsql procedure with 1
    parameter type table index, it works fine. But, when I use 2
    parameters type table index, it throws the exception with this
    message:
    ORA-01036: illegal variable name/number
    Thanks,
    Andres.

    Hi Simi,
    now, it is working well in the JDeveloper 9i, but when I deploy
    the files in the iAS server (1.0.2.2.1), it shows an exception:
    ORA-00932: inconsistent datatypes
    Just because of the table index parameter.
    I have changed the classes12 file in the home/lib directory in
    the OC4J without success with:
    classes12.jar original from lib directory.
    classes12.zip original from iAS's client BD.
    classes12.zip original from Oracle client BD 8.1.7. (C:\orant8
    \jdbc\lib)
    classes12.zip original from Oracle client BD 9i. (C:\orant9
    \jdbc\lib)
    classes12.jar original from Oracle client BD 9i. (C:\orant9
    \jdbc\lib)
    classes12.zip original from JDeveloper 9i. (C:jdev9i\lib)
    My java program is:
    connection.prepareCall("{call user.package.proc
    ocs.setString(1, cod);
    ocs.registerOutParameter(2, OracleTypes.VARCHAR);
    ocs.registerOutParameter(3, OracleTypes.VARCHAR);
    ocs.registerOutParameter(4, OracleTypes.VARCHAR);
    ocs.registerOutParameter(5, OracleTypes.VARCHAR);
    ocs.registerOutParameter(6, OracleTypes.VARCHAR);
    ocs.registerIndexTableOutParameter(7, 50,
    OracleTypes.VARCHAR, 100);
    ocs.registerOutParameter(8, OracleTypes.VARCHAR);
    ocs.registerOutParameter(9, OracleTypes.VARCHAR);
    ocs.registerOutParameter(10, OracleTypes.INTEGER);
    ocs.registerOutParameter(11, OracleTypes.VARCHAR);
    ocs.execute();
    My plsql header is:
    TYPE StringTabTyp IS TABLE OF table.column%TYPE
    INDEX BY BINARY_INTEGER;
    PROCEDURE proc
    ( ps1 IN VARCHAR2,
    ps2 OUT VARCHAR2,
    ps3 OUT VARCHAR2,
    ps4 OUT VARCHAR2,
    ps5 OUT VARCHAR2,
    ps6 OUT VARCHAR2,
    ps7 OUT StringTabTyp,
    ps8 OUT VARCHAR2,
    ps9 OUT VARCHAR2,
    pnRet OUT NUMBER,
    psRet OUT VARCHAR2
    If the parameter ps7 is of type VARCHAR2, it works. But if it is
    of type StringTabTyp (Table Index), this message is generated:
    ORA-00932: inconsistent datatypes
    Any idea will be useful.
    Thank you very much.
    Andres.

  • Primary key index not working in a select  statment

    Hi ,
    I'm doing a :
    select *
    from my_table
    where B = v1 and
    A = v2 ;
    where A and B are the primary key of the table, in that table the primary key index is there and the order of the primary key definition is A first and then B.
    While testing this statment in my database the Explain Plan shows that it is using the index ok but when
    runninng in client database it is not using it becasue of the order (i think), is this something configurable that I need to ask to my DBA ?
    The solution I found was to do the select with a hint wich fix the problem , but I'm curious about why is working in my dadabase and not in the client database
    thanks in advance .
    oracle version 11g

    This is the forum for SQL Developer (Not for general SQL/PLSQL questions). Your question would be better asked in the SQL and PL/SQL forum.
    Short answer: The execution plan used will depend on optimizer settings and table/index statistics. For example if the table has very few rows it may not bother using the index.

  • Get distinct values from plsql array

    Hi,
    I have declared a variable as below in plsql proc.
    type t_itemid is table of varchar2(10);
    inserted set of items in to this using a program
    now i want distinct values from that array how can i get it.

    I am using 9i so i cannot use set operator and more over my problem is that i am declaring the variable inside the plsql block . when i tried i am getting the below errors:
    SQL> r
    1 declare
    2 type t_type is table of varchar2(10);
    3 v_type t_type;
    4 begin
    5 v_type := t_type('toys','story','good','good','toys','story','dupe','dupe');
    6 for i in (select column_value from table(v_type)) loop
    7 dbms_output.put_line(i.column_value);
    8 end loop;
    9* end;
    for i in (select column_value from table(v_type)) loop
    ERROR at line 6:
    ORA-06550: line 6, column 41:
    PLS-00642: local collection types not allowed in SQL statements
    ORA-06550: line 6, column 35:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    ORA-06550: line 6, column 10:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 7, column 22:
    PLS-00364: loop index variable 'I' use is invalid
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored

  • Associative Array with subsripts(Index) as Varchar2

    Hi All,     
    I m using Oracle Version 10.1.0.2.0 - Production     
    I have the following requirement:     
    The Associative array which holds the value with the subscripts(Index) as database table column.
    Create table Period_master
    Period_code_c Varchar2(10),
    Period_frm_dt Date,
    Period_to_dt Date,
    Year_code_c     Varchar2(10)
    Insert into period_master values ('10',to_date('01/01/2012','dd/mm/rrrr'),to_date('31/01/2012','dd/mm/rrrr'),'2011-2012');
    Insert into period_master Values ('11',to_date('01/02/2012','dd/mm/rrrr'),to_date('29/02/2012','dd/mm/rrrr'),'2011-2012');
    Insert into period_master Values ('12',to_date('01/03/2012','dd/mm/rrrr'),to_date('31/03/2012','dd/mm/rrrr'),'2011-2012');
    Insert into period_master Values ('13',to_date('01/04/2012','dd/mm/rrrr'),to_date('30/04/2012','dd/mm/rrrr'),'2012-2013');
    Insert into period_master Values ('14',to_date('01/05/2012','dd/mm/rrrr'),to_date('31/05/2012','dd/mm/rrrr'),'2012-2013');
    Commit;
    SQL > Select * from Period_Master;
    Period_code --- Period_frm_dt --- Period_to_dt ---- Year_code_c
    10     ---     01/01/2012 ---     31/01/2012     --- 2011-2012
    11     ---     01/02/2012 ---     29/02/2012     --- 2011-2012
    12     ---     01/03/2012 ---     31/03/2012     --- 2011-2012
    13     ---     01/04/2012 ---     30/04/2012     --- 2012-2013
    14     ---     01/05/2012 ---     31/05/2012     --- 2012-2013     
    My Requirement is get the Period_frm_dt,period_end_dt and yearcode based on period_code (which is input parameters from my procedure) by using Collections.
    I have to create one PLSQL table type which having the subscripts(Index) as period_code which is Varchar2 type;
    I have written follwing code ,but it's not giving the desired output:
    Declare
    iv_period Varchar2(10);
    Cursor cur_prd(cp_period Varchar2) is select * from Period_Master Where Period_code_c = cp_period;
    TYPE PRD_REC_TY IS TABLE OF cur_prd%ROWTYPE INDEX BY PLS_INTEGER;
    lv_prd_data prd_rec_ty;
    lv_prd PERIOD_MASTER.period_code_c%TYPE ;
    lv_frm_dt PERIOD_MASTER.Period_frm_dt%TYPE ;
    lv_to_dt PERIOD_MASTER.Period_to_dt%TYPE ;
    lv_yr_code PERIOD_MASTER.Year_code_c%TYPE ;
    Begin
    iv_period := :period;
    Open Cur_prd(iv_period);
    Loop
    Fetch cur_prd BULK COLLECT into lv_prd_data;
    EXIT WHEN cur_prd%NOTFOUND;
    End Loop;
    Close Cur_Prd;
    If lv_prd_data.COUNT > 0 THEN
    For i IN lv_prd_data.FIRST .. lv_prd_data.LAST
    LOOP
    lv_prd := lv_prd_data(i).pERIOD_cODE_C;
    lv_frm_dt := lv_prd_data(i).Period_frm_dt;
    lv_to_dt := lv_prd_data(i).Period_to_dt;
    lv_yr_code := lv_prd_data(i).Year_Code_c;
    Dbms_output.Put_line('For Period code : '||lv_prd||' the Year code is : '||lv_yr_code);
    Dbms_output.Put_line('For Period code : '||lv_prd||' the Period_from_dt is : '||lv_frm_dt);
    Dbms_output.Put_line('For Period code : '||lv_prd||' the Period_to_dt is : '||lv_to_dt);
    END LOOP;
    End if;
    Exception
    When Others Then
    Dbms_output.Put_line('Here Error Found: '||SQLERRM);
    End;
    But My requirement is to get the FRM_DT,TO_DT and YEAR CODE as per the following:
    For Period Code :*11* -- the YearCode is --- *2011-2012*
    For Period Code :*11* -- the From Dt is --- *01/02/2012*
    For Period Code :*11* -- the To Dt is --- *29/02/2012*
    for Period Code : *14* -- the Yearcode is --- *2012-2013*
    For Period Code : *14* -- the From Dt is --- *01/05/2012*
    For Period Code : *14* -- the To Dt is --- *31/05/2012*
    So on...
    Like:
    lv_yr_code := lv_period_data(iv_period).Year_code_c;
    lv_frm_dt := lv_period_data(iv_period).Period_frm_dt;
    lv_to_dt := lv_period_data(iv_period).Period_to_dt;
    Dbms_output.Put_line('For Period code : '||iv_period||' the Year code is : '||lv_yr_code);
    Dbms_output.Put_line('For Period code : '||iv_period||' the Period_from_dt is : '||lv_frm_dt);
    Dbms_output.Put_line('For Period code : '||iv_period||' the Period_to_dt is : '||lv_to_dt);
    How do i resolve the above scenario.Please help me to resove the above scenario.
    Regards,
    Prasanta

    Hi, Pransanta,
    Prasanta wrote:
    ... My Requirement is get the Period_frm_dt,period_end_dt and yearcode based on period_code (which is input parameters from my procedure) by using Collections.Sorry, I don't understand.
    What is the porocedure you mentioned? Do you mean the anonymous block that you posted? If not, post the procedure. How is it related to the anonymous block? E.g., does the anonymous block need to call the procedure?
    I have to create one PLSQL table type which having the subscripts(Index) as period_code which is Varchar2 type;
    I have written follwing code ,but it's not giving the desired output:
    Declare
    iv_period Varchar2(10);Please format your code, and use \ tags to keep the formatting when you post it on this site.
    See the forum FAQ {message:id=9360002}
    Cursor cur_prd(cp_period Varchar2) is select * from Period_Master Where Period_code_c = cp_period;You're only looking for a single given period_code_c.  If you want to get all rows, lose the WHERE clause.  If you want to multiple rows, but not all rows, then use an appropriate WHERE clause.
    TYPE PRD_REC_TY IS TABLE OF cur_prd%ROWTYPE INDEX BY PLS_INTEGER;
    lv_prd_data prd_rec_ty;
    lv_prd PERIOD_MASTER.period_code_c%TYPE ;
    lv_frm_dt PERIOD_MASTER.Period_frm_dt%TYPE ;
    lv_to_dt PERIOD_MASTER.Period_to_dt%TYPE ;
    lv_yr_code PERIOD_MASTER.Year_code_c%TYPE ;
    Begin
    iv_period := :period;Post the code that declares and sets :period.
    Open Cur_prd(iv_period);
    Loop
    Fetch cur_prd BULK COLLECT into lv_prd_data;
    EXIT WHEN cur_prd%NOTFOUND;
    End Loop;
    Close Cur_Prd;
    If lv_prd_data.COUNT > 0 THEN
    For i IN lv_prd_data.FIRST .. lv_prd_data.LAST
    LOOP
    lv_prd := lv_prd_data(i).pERIOD_cODE_C;
    lv_frm_dt := lv_prd_data(i).Period_frm_dt;
    lv_to_dt := lv_prd_data(i).Period_to_dt;
    lv_yr_code := lv_prd_data(i).Year_Code_c;If the block is just supposed to do what it's doing now; then you don't need all these local variables.  It's simpler just to teference lv_prd_data.
    If you're planning to add some other code to the block later, then the local variables could be useful.
    Dbms_output.Put_line('For Period code : '||lv_prd||' the Year code is : '||lv_yr_code);
    Dbms_output.Put_line('For Period code : '||lv_prd||' the Period_from_dt is : '||lv_frm_dt);
    Dbms_output.Put_line('For Period code : '||lv_prd||' the Period_to_dt is : '||lv_to_dt);
    END LOOP;
    End if;
    Exception
    When Others Then
    Dbms_output.Put_line('Here Error Found: '||SQLERRM);Only use an EXCEPTION section when you need to.  The EXCEPTION section above is only hiding some information about the error.
    End;
    But My requirement is to get the FRM_DT,TO_DT and YEAR CODE as per the following:
    For Period Code :*11* -- the YearCode is --- *2011-2012*
    For Period Code :*11* -- the From Dt is --- *01/02/2012*
    For Period Code :*11* -- the To Dt is --- *29/02/2012*
    for Period Code : *14* -- the Yearcode is --- *2012-2013*
    For Period Code : *14* -- the From Dt is --- *01/05/2012*
    For Period Code : *14* -- the To Dt is --- *31/05/2012*
    So on...
    Like:
    lv_yr_code := lv_period_data(iv_period).Year_code_c;
    lv_frm_dt := lv_period_data(iv_period).Period_frm_dt;
    lv_to_dt := lv_period_data(iv_period).Period_to_dt;
    Dbms_output.Put_line('For Period code : '||iv_period||' the Year code is : '||lv_yr_code);
    Dbms_output.Put_line('For Period code : '||iv_period||' the Period_from_dt is : '||lv_frm_dt);
    Dbms_output.Put_line('For Period code : '||iv_period||' the Period_to_dt is : '||lv_to_dt);
    How do i resolve the above scenario.Please help me to resove the above scenario.
    Regards,
    PrasantaIf the problem is that you need to show all period_code_cs, not just one, then you can do this:DECLARE
    CURSOR cur_prd
    IS SELECT *
         FROM     period_master
         ORDER BY period_code_c;
    TYPE prd_rec_ty IS TABLE OF cur_prd%ROWTYPE INDEX BY PLS_INTEGER;
    lv_prd_data prd_rec_ty;
    BEGIN
    OPEN cur_prd;
    FETCH cur_prd BULK COLLECT into lv_prd_data;
    CLOSE cur_prd;
    IF lv_prd_data.COUNT > 0
    THEN
    FOR i IN lv_prd_data.FIRST .. lv_prd_data.LAST
         LOOP
         dbms_output.put_line ( 'For Period code : '
                        || lv_prd_data(i).period_code_c
                        || ' the Year code is : '
                        || lv_prd_data(i).year_code_c
         dbms_output.Put_line ( 'For Period code : '
                        || lv_prd_data(i).period_code_c
                        || ' the Period_from_dt is : '
                        || lv_prd_data(i).period_frm_dt
         dbms_output.put_line ( 'For Period code : '
                        || lv_prd_data(i).period_code_c
                        || ' the Period_to_dt is : '
                        || lv_prd_data(i).period_to_dt
         END LOOP;
    END IF;
    END;

  • Need advise on SQL,plsql developer career and future

    Hi all,
    I need all your advise in making an important decisions of my career path.I work in the IT field and have about total 4-5 years of work experience involving development and testing in a product based organization.
    Presently-i have got chance since last 4-5 months to work with writing PLSQL code,SQL etc on a part basis. I am very much interested to continue my career path as a PLSQL developer.
    But, unfortunately -in the total of my work experience-in the past 2-3 years-i worked with a internally developed DB query language(similar to SQL) and then from last few months with plsql. But this chance to work with PLSQL has been for less time and limited scope after which i will have to work on something different.
    Ii want to fully take on my career in SQL,PLSQL as Database Developer.
    Please advise me if my thinking seems logical and good and if I could do it. I have planned on applying for relevant SQL,PLSQL profile jobs.
    Now, My serious worry and concern is I feel that since i have worked very less with PLSQL-so am low in confidence that I feel i wont be able to answer ,or tell or not knowledgeable enough to be able to clear the technical interviews for SQL,plsql development profile which would need at least some years of experience.
    I have started studying and practsing PLSQL,sql by myself for from internet. So, can you all please advise me on how could i prepare myself for hard core technical interviews of SQL,PLSQL knowledge for about 2-3 years expertise.
    I know its not much possible to be competent so much in the subject by just studying and practicing.Its easy as saying to study and get it by myself-but i want to try and will put my best for it.
    Please help me with your inputs,all interview questions,hard ones-suggestions,links,any study materials, real time problems which i can try solving of SQL, PLSQL development.
    Thanks All

    Hi,
    A very good starting point is (in my opinion): [Steven Feuerstein PL/SQL Obsession|http://www.toadworld.com/Knowledge/DatabaseKnowledge/StevenFeuersteinsPLSQLObsession/tabid/153/Default.aspx]. Also the official site [PL/SQL Technology Center|http://www.oracle.com/technology/tech/pl_sql/index.html]
    Regards,

Maybe you are looking for

  • How can i restore my ipod 4 8g after accidentally reset all the files?

    How can i restore the Apllications for my ipod touch 4 8g? I accidentally reset all files and documents and cannot open again. Once i turned on the unit it only displays the apple logo. please help me.

  • Need another pair of eyes to help on this form..........

    Hello Everyone, I have a form that needs a little love.....I have it setup to take values from drop downs and match the values from numeric fields with the dropdowns and multiply the information depending on what is selected.  The problem I am runnin

  • Should I still down-size photos for my website?

    Hi - I am making a website.  I know - or at least I think I know - that you should down-size your images for fast loading times.  For example, if I have a photo that's 3800x3800 and is 2 MB in size, I always down-size it to maybe 1000x1000 and about

  • Configure Sap NetWeaver MDM with Sap Netweaver XI

    SAP NetWeaver MDM communicates with SAP NetWeaver XI by writing an XML file into a directory on a file server. Can someone gives me  an idea about the path of this file server? How can I configure it?

  • Warp stabilize AND slow speed

    I want to warp stabilize AND slow speed which are incompatible, so what is the recommended route on this please? E.G. I would anticipate we must export one and reimport to do the other, or what? In which order?  Is there a smarter way? Does export re