How To Open A Cursor Using Exec_SQL?

Declare
V_Connection_id Exec_SQL.ConnType;
V_CursorID Exec_SQL.CursType;
V_SqlStr VarChar2(30000);
V_NIgn PLS_Integer;
Cursor V_User_Cur Is
Select Group_Name
From NVS_USERS_VS_GROUPS_VW
Where Upper(USR_NAME) = User;
Begin
V_Connection_id := Exec_SQL.Open_Connection('PAL_SECURITY','PAL_SECURITY','DPC');
V_CursorID := Exec_SQL.Open_Cursor(V_Connection_id);
--------------------> Can't open a cursor here ?
For V_User_Cur_Rec In (Select Group_Name
From NVS_USERS_VS_GROUPS_VW
Where Upper(USR_NAME) = User ) Loop
V_SqlStr := 'Grant Nvs$_'||V_User_Cur_Rec.Group_Name ||'To '||User;
Exec_SQL.Parse(V_Connection_id, V_CursorID, V_SqlStr, Exec_SQL.V7);
V_NIgn := Exec_SQL.Execute(V_Connection_id, V_CursorID);
End Loop;
/******************* Error*******************************/
Exec_SQL.Close_Cursor(V_CursorID);
Exec_SQL.Close_Connection;
END;

What is the Error you are getting? Since you are attempting to grant privileges using the EXEC_SQL package, the error code/message is very important! ;-)
Craig...

Similar Messages

  • How to open/read file using Java in Unix?

    Hi Friends,
    Can you please help me out how to open/read file using java in unix os? I have create one text file in "/home/test.txt" in unix environment. How to open the same file & read using java code?
    - Hiren Modi

    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • How to open multi tasking using gesture in iphone 5s 7.0.6(11B651)

    How to open multi tasking using gesture in iphone 5s 7.0.6(11B651), i m able to open only by double press of centre button or using accessilbity multi tasking option.
    is it possible to open like ipad using a five finger upward gesture?

    is it possible to open like ipad using a five finger upward gesture?
    No. The "double click" method is the only way.
    iOS: Understanding multitasking - Support - Apple

  • I have downloaded an app from the Istore and now I can't figure out how to open it or use it

    I have downloaded an app to use on my laptop and now I can't figure out how to open it and use it.  It shows it in the download area..........any suggestions would be great.

    Have you looked in your menu of programs (in Windows:  Start -> All Programs -> etc....)?

  • Opening two cursors using open cursor with bulk collect on colections ..

    Is it possible to have the implementatiion of using bulk collect with collections using two open cursors ..
    first c1
    second c2
    open c1
    loop
    open c2
    loop
    end loop
    close c2
    end loop;
    close c1
    what i found is for every outer loop of cursor c1 , cursor c2 is open and closed for every record.
    is this willl imporove the performace .?
    EXAMPLE:-
    NOTE: The relatoin between finc and minc is one to many ..finc is parent and minc is child
    function chk_notnull_blank ( colname IN number ) return number is
    BEGIN
    if ( colname is NOT NULL and colname not in ( -8E14, -7E14, -6E14, -5E14, -4E14, -3E14, -2E14, -1E14, -1E9 )) then
    RETURN colname ;
    else
    RETURN 0;
    end if;
    END chk_notnull_blank;
    procedure Proc_AnnualFmlyTotIncSummary is
    CURSOR c_cur_finc IS SELECT FAMID FROM FINC ;
    CURSOR c_cur_minc IS SELECT FAMID, MEMBNO , ANFEDTX, ANGOVRTX, ANPRVPNX, ANRRDEDX, ANSLTX, SALARYX, SALARYBX, NONFARMX, NONFRMBX , FARMINCX, FRMINCBX, RRRETIRX, RRRETRBX, SOCRRX, INDRETX, JSSDEDX, SSIX, SSIBX from MINC minc WHERE FAMID IN ( SELECT FAMID FROM FINC finc WHERE minc.FAMID = finc.FAMID );
    v_tot_fsalaryx number := 0;
    v_tot_fnonfrmx number := 0;
    v_tot_ffrmincx number := 0;
    v_tot_frretirx number := 0;
    v_tot_findretx number := 0;
    v_tot_fjssdedx number := 0;
    v_tot_fssix number := 0;
    v_temp_sum_fsalaryx number := 0;
    v_temp_sum_fnonfrmx number := 0;
    v_temp_sum_ffrmincx number := 0;
    v_temp_sum_frretirx number := 0;
    v_temp_sum_findretx number := 0;
    v_temp_sum_fjssdedx number := 0;
    v_temp_sum_fssix number := 0;
    TYPE minc_rec IS RECORD (FAMID MINC.FAMID%TYPE, MEMBNO MINC.MEMBNO%TYPE , ANFEDTX MINC.ANFEDTX%TYPE, ANGOVRTX MINC.ANGOVRTX%TYPE , ANPRVPNX MINC.ANPRVPNX%TYPE , ANRRDEDX MINC.ANRRDEDX%TYPE , ANSLTX MINC.ANSLTX%TYPE, SALARYX MINC.SALARYX%TYPE , SALARYBX MINC.SALARYBX%TYPE , NONFARMX MINC.NONFARMX%TYPE , NONFRMBX MINC.NONFRMBX%TYPE, FARMINCX MINC.FARMINCX%TYPE , FRMINCBX MINC.FRMINCBX%TYPE , RRRETIRX MINC.RRRETIRX%TYPE , RRRETRBX MINC.RRRETRBX%TYPE, SOCRRX MINC.SOCRRX%TYPE , INDRETX MINC.INDRETX%TYPE , JSSDEDX MINC.JSSDEDX%TYPE , SSIX MINC.SSIX%TYPE , SSIBX MINC.SSIBX%TYPE );
    v_flag_boolean boolean := false;
    v_famid number ;
    v_stmt varchar2(3200) ;
    v_limit number := 50;
    v_temp_FAMTFEDX number := 0 ;
    v_temp_FGOVRETX number := 0 ;
    v_temp_FPRIVPENX number := 0 ;
    v_temp_FRRDEDX number := 0 ;
    v_temp_FSLTAXX number := 0 ;
    v_temp_FSALARYX number := 0 ;
    v_temp_FNONFRMX number := 0 ;
    v_temp_FFRMINCX number := 0 ;
    v_temp_FRRETIRX number := 0 ;
    v_temp_FINDRETX number := 0 ;
    v_temp_FJSSDEDX number := 0 ;
    v_temp_FSSIX number := 0 ;
    BEGIN
    OPEN c_cur_finc ;
    LOOP
         FETCH c_cur_finc BULK COLLECT INTO famid_type_tbl LIMIT v_limit;
         EXIT WHEN famid_type_tbl.COUNT = 0;
         FOR i in famid_type_tbl.FIRST..famid_type_tbl.LAST
         LOOP
         OPEN c_cur_minc ;
         LOOP
         FETCH c_cur_minc BULK COLLECT INTO minc_rec_type_tbl LIMIT v_limit;
         EXIT WHEN minc_rec_type_tbl.COUNT = 0;
              FOR j IN minc_rec_type_tbl.FIRST..minc_rec_type_tbl.LAST
              LOOP
              if ( famid_type_tbl(i) = minc_rec_type_tbl(j).FAMID ) THEN
              v_temp_FAMTFEDX := v_temp_FAMTFEDX + chk_notnull_blank(minc_rec_type_tbl(j).ANFEDTX );
              v_temp_FGOVRETX := v_temp_FGOVRETX + chk_notnull_blank(minc_rec_type_tbl(j).ANGOVRTX);
              v_temp_FPRIPENX := v_temp_FPRIPENX + chk_notnull_blank(minc_rec_type_tbl(j).ANPRVPNX);
              v_temp_FRRDEDX := v_temp_FRRDEDX + chk_notnull_blank(minc_rec_type_tbl(j).ANRRDEDX);
              v_temp_FSLTAXX := v_temp_FSLTAXX + chk_notnull_blank(minc_rec_type_tbl(j).ANSLTX );
              v_temp_FSALARYX := v_temp_FSALARYX + chk_notnull_blank(minc_rec_type_tbl(j).SALARYX ) + chk_notnull_blank(minc_rec_type_tbl(j).SALARYBX);
              v_temp_FNONFRMX := v_temp_FNONFRMX + chk_notnull_blank(minc_rec_type_tbl(j).NONFARMX) + chk_notnull_blank(minc_rec_type_tbl(j).NONFRMBX);
              v_temp_FFRMINCX := v_temp_FFRMINCX + chk_notnull_blank(minc_rec_type_tbl(j).FARMINCX) + chk_notnull_blank(minc_rec_type_tbl(j).FRMINCBX );
              v_temp_FRRETIRX := v_temp_FRRETIRX + chk_notnull_blank(minc_rec_type_tbl(j).RRRETIRX) + chk_notnull_blank(minc_rec_type_tbl(j).RRRETRBX ) + chk_notnull_blank(minc_rec_type_tbl(j).SOCRRX);
              v_temp_FINDREXT := v_temp_FINDRETX + chk_notnull_blank(minc_rec_type_tbl(j).INDRETX);
              v_temp_FJSSDEDX := v_temp_FJSSDEDX + chk_notnull_blank(minc_rec_type_tbl(j).JSSDEDX);
              v_temp_FSSIX := v_temp_FSSIX + chk_notnull_blank(minc_rec_type_tbl(j).SSIX ) + chk_notnull_blank(minc_rec_type_tbl(j).SSIBX);
              END IF;
              END LOOP;
         END LOOP ;
         CLOSE c_cur_minc;
         UPDATE FINC SET FAMTFEDX = v_temp_FAMTFEDX WHERE FAMID = famid_type_tbl(i);
         END LOOP;
    END LOOP;
    CLOSE c_cur_finc;
    END;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    v_err_code := SQLCODE;
    v_err_msg := substr(SQLERRM, 1, 200);
    INSERT INTO audit_table (error_number, error_message) VALUES (v_err_code, v_err_msg);
    error_logging(p_error_code => substr(sqlerrm,1,9), p_error_message => substr(sqlerrm,12), p_package =>'PKG_FCI_APP',p_procedure => 'Proc_Annual_Deductions_FromPay ' , p_location => v_location);
    end Proc_AnnualFmlyTotIncSummary ;
    Is the proga efficient and free from compilation errors ..?
    thanks/kumar
    Edited by: kumar73 on Sep 22, 2010 12:48 PM

    function chk_notnull_blank ( colname IN number ) return number is Maybe this function should have its own forum:
    how to use case in this program
    Re: how to declare a formal parameter in a function of type record and access ?
    Re: how to define a function with table type parameter
    Re: creation of db trigger with error ..
    Re: How to write a trigger for the below scenario
    how to improve the code using advanced methods
    yours advice in improving the coding ..
    How to use bulk in multiple cursors !!
    ;-)

  • How to open a cursor based on XML data?

    Hello,
    I am using Oracle 11g database.
    I am required to write a stored procedure accepting an input of XML CLOB.
    Upon receiving the CLOB, I'm required to open a cursor for XML tags and then process each 'XML record'.
    I am not sure how to achieve this.
    Referred to the following link: http://docs.oracle.com/cd/B28359_01/appdev.111/b28369/xdb03usg.htm#CEGDJEEI
    But could not meet the requirement.
    Appreciate your suggestions.
    Amar

    something
    create or replace procedure prc (inxml clob, xml_cursor out  sys_refcursor)
    x xmltype;
    begin
       select xmltype(inxml) into x from dual;
       open xml_cursor for
             select extractvalue(x,'/tag') from dual;
    ...Edited by: AlexAnd on Nov 21, 2011 1:36 AM

  • How to access oracle cursors using jdbc (expecting ur earliest reply)

    Hi All,
    can anyone help me out by giving me an idea or sample code in accessing the cursors that are defined in the oracle... i have to access those cursors using java... Thanks in advance for your reply and time....
    Ragu

    I have tried to follow the example from the URL link you provided.
    I'm using :
    - Oracle 8.1.6/8.1.7
    - JDK 1.3.1
    I've created:
    create or replace package types
    as
    type cursorType is ref cursor;
    end;
    create or replace function sp_ListEmp return types.cursortype
    as
    l_cursor types.cursorType;
    begin
    open l_cursor for
    select ename, empno
    from emp
    order by ename;
    return l_cursor;
    end;
    Then I have on my code the following:
    import java.sql.*;
    import oracle.jdbc.driver.*;
    String conStatus = "":
    String driver_class = "oracle.jdbc.driver.OracleDriver";
    String connect_string = "jdbc:oracle:thin:@slackdog:1521:oracle8";
    String query = "begin :1 := sp_listEmp; end;";
    Connection conn;
    Class.forName(driver_class);
    conn = DriverManager.getConnection(connect_string, "scott", "tiger");
    try{
    conStatus = "before prepareCall, ";
    CallableStatement cstmt = conn.prepareCall(query);
    conStatus = conStatus + "before Register out, ";
    cstmt.registerOutParameter(1,OracleTypes.CURSOR);
    conStatus = conStatus + "before execute, ";
    cstmt.execute();
    conStatus = conStatus + "before getObject, ";
    ResultSet rset = (ResultSet)cstmt.getObject(1);
    while (rset.next ())
    System.out.println( rset.getString (1) );
    cstmt.close();
    } catch (Exception e) {
    conStatus = conStatus + e;
    System.out.println(conStatus);
    What happens is that I am able to successfully compile the code. But when I run the code, it displays:
    "before prepareCall, before Register out, SQLException: incompatible types = -10."
    What does that mean? Pls point out to me what I did wrong in my code.
    Thanks.

  • How to open a file using OAF

    Hi,
    I want to open a file using OAF. I know the path and file name.
    How can I open it, if file is in UNIX or in windows, where ever.
    Is there any way to do that.
    Thanks in Advance!!

    Hi Ankur,
    I had something link this requirement, that also for a concurrent program output only, but the output was txt file, and make it a zip file and give a dynamic link and open it.
    For that i used the following code, may be it will help.
    String zipout = pageContext.getParameter("ZIPOUT");
    if(zipout!=null && zipout.equals("Y"))
    try
    DataObject sessionDictionary = (DataObject) pageContext.getNamedDataObject("_SessionParameters");
    HttpServletResponse response = (HttpServletResponse) sessionDictionary.selectValue(null, "HttpServletResponse");
    HttpServletRequest request = (HttpServletRequest) sessionDictionary.selectValue(null, "HttpServletRequest");
    String requestID = pageContext.getParameter("REQUESTID");
    response.setHeader("Content-Disposition","p; filename=CatExtract"+requestID+".zip");
    response.setContentType("application/x-zip-compressed");
    ZipOutputStream zip = new ZipOutputStream(response.getOutputStream());
    try
    byte[] buffer = new byte[1024];
    int bytesRead;
    //to get the value of output directory
    String fileName = "/o"+requestID+".out";
    Serializable[] parameters = { requestID };
    //Get the output URL for this requests output.
    pageContext.getApplicationModule(webBean).invokeMethod("getOutputURL", parameters);
    String outputURL = (String)pageContext.getTransactionValue("OutputURL");
    pageContext.writeDiagnostics(this.getClass().getName(),"outputURL in the xxt CO"+outputURL,1);
    try
    URL fileURL = new URL(outputURL);
    URLConnection urlConn = fileURL.openConnection();
    DataInputStream out = new DataInputStream(urlConn.getInputStream());
    try
    ZipEntry entry = new ZipEntry(fileName);
    zip.putNextEntry(entry);
    while ((bytesRead = out.read(buffer)) != -1)
    zip.write(buffer, 0, bytesRead);
    zip.closeEntry();
    pageContext.writeDiagnostics(entry.getName(), " added.",1);
    catch (Exception ex)
    pageContext.writeDiagnostics(this.getClass().getName(),"Exception 113"+ex,1);
    finally
    out.close();
    catch (IOException ex)
    pageContext.writeDiagnostics(this.getClass().getName(),"Exception 124"+ex,1);
    System.out.println("Exception 124 "+ex);
    Thanks.
    With Regards,
    Kali.

  • How to open a browser using button?

    Hi,experts,
    I create a button in a view in the WDJ.
    I can get a URL through call a webservice when I click the button and I need open a browser using the URL automatically. 
    How can I do it?
    Best regards,
    tao

    Hi Tao,
    You can use the following method of WindowManager in the action assigned to onAction event of your button:
    wdComponentAPI.getWindowManager().createNonModalExternalWindow(String URL,String  title);
    Regards,
    Ajay

  • How to open specific port using java program

    Hello,
    I want to open ,close port using java comm.plz help me how can i do it.is it possible
    by using java program.later i want to use that specific port to accept the server socket connection .plz
    help me.

    i try this java program.*but it get block in accept method*.tht mean i m not able to make connection with port.
    import java.sql.SQLException;
    import java.io.IOException;
    import java.net.ServerSocket;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    class MakeConn
         public final static int PORT = 7788;
    public static java.net.Socket clientSocket = null;
    public static java.io.PrintWriter pw = null; // socket output stream
    public static java.io.BufferedReader br = null;
    public static ServerSocket server_socket;
         public static void main(String[] args) throws SQLException
         try {
              server_socket = new ServerSocket(PORT);
    clientSocket = server_socket.accept();
    System.out.println("CLIENT>>>" + clientSocket);
         br = new java.io.BufferedReader(new java.io.InputStreamReader(clientSocket.getInputStream()));
    pw = new java.io.PrintWriter(clientSocket.getOutputStream(), true);
    String message = br.readLine().trim();
    System.out.println("message is"+message);
    pw.close(); // close everything
    br.close();
    clientSocket.close();
         catch (Exception ex) {
    ex.printStackTrace();
    }

  • How to open modal popup using javascript in iPad ?

    Hi Apps masters
    How to open modal dialog ?
    How to return selected value to parent value ?
    How to close modal dialog ??
    Thanks,

    Hi,
    Try This
    function aboutOkButton(event) {
    var v= event.getSource();
    var popup = v.findComponent("popupId");
    popup.hide();
    event.cancel();
    Sameh Nassar

  • How to open saved files using 'read from text file' function

    Hi everyone, I am having a hard time trying to solve the this particular problem ( probably because I am a newb to lanbview ). Anyway , I am able to save the acquired waveforms by using the 'Write to text file' icon. I did manually modify the block diagram of the 'Write to text file' icon and create the correct number of connector so as to make my program work. But now I have no idea on how to modify the block diagram of the 'Read from text file' block diagram to make my program 'open' my saved waveforms. Or i do not have to modify anything from the block diagram of the 'Read from text file'? Can anyone teach/help me connect up? Do i need the build array on the "open" page?
    Here are some screenshots on part of my program  
    let me know if you guys would need more information / screenshots thank you!
    Attachments:
    ss_save.jpg ‏94 KB
    ss_open.jpg ‏94 KB
    modified_writetotextfile.jpg ‏99 KB

    Ohmy, thanks altenbach. oh yeah i forgot about those sub VIs. will upload them now. Was rather demoralized after reading the comments and really struck me on how weak i'm at on labview really hope to get this done. But of course i have to study through and see how it works. Actually i am going to replace those 'signal generators sub vi' with ThoughtTechonology's sample code so i can obtain data waveforms real-time using Electrocardiography (ECG) ,Electromyography (EMG ) and Electroencephalography (EEG) hopefully i can find out how to connect the sample code.
    ( ps . cant connect it now unless my program is working otherwise labview will crash ) 
    ( p.s.s the encoder of my biofeedback trainer already acts as an DAQ so i wont need to place an DAQ assistant in my block diagram i suppose )
    The sample code of ThoughtTechnology is named as attachment.ashx.vi. too bad i cant use it and present it as my project
    Attachments:
    frequency detactor.vi ‏53 KB
    signal generator.vi ‏13 KB
    attachment.ashx.vi ‏40 KB

  • How to open Word Document using java?

    Respected Sir/ Madam,
    I am doing my project in Network Security using java. I have to transfer the files from server to the client. Each transferred file should have some of the access privileges such as read, write and exeucte. If the transferred file is a word document means then automatically the client should open Microsoft word and if the file is having Read Permission alone then the save, Save As, cut,copy, paste options in the MS - Word should be disabled. This is similar for all the files that i have transferred. That is if the transferred file is excel, audio, video,txt file the corresponding application should be opened properly. How could I acheive this. If the file is having write permission then if the user clicks the save option then the contents of the file should be saved in the server machine not in the client machine, Could we achieve this???? Can anyone help me regarding this? Please give me your views about this query?

    Respected Sir / Madam,
    Thank you very much for your reply. Could we use Microsoft API inside java program to achieve my doubts?? Could U explain it more????

  • How to open downloadable books using Overdrive?

    Hi,
    (If this is not the most appropriate forum, would someone redirect me?)
    The public library offers a great service in downloadable books. They are readable using Overdrive (extension .odm)
    However, I cannot open them on my Mac. Here is what Apple has to say when I try to open my book:
    Is there something I am missing? Or another way to do this? Surely Apple isn't blocking library books!

    I found this info to be very clear and helpful:
    http://help.overdrive.com/customer/portal/articles/1481567-how-to-set-overdrive- media-console-to-open-odm-files-automatically-in-mac

  • How to open an app using LabVIEW PDA Module 7.1

    Hi,
    i´m developing an app using LabVIEW PDA Module 7.1 that needs to open a
    standard application (in particular, the default camera application) on
    my PDA (Qtek 2020 with Pocket PC 2003). Can anyone tell me how to do it?
    Thanks,
    Pedro Sampaio
    Computer and Telecommunications Engineer Student
    ESTG -IPL, Portugal

    Olá,
    Com o project podes fazer builr e deploy, a partiur daí tens a aplicação instalada na PDA.
    Cumprimentos

Maybe you are looking for

  • How do I change the name of an iMac I bought second hand?

    Just bought a second-hand iMac G5 PPC (for minimal use for volunteer work, etc.)  I know I can't upgrade any further, but I would like to rename it permanently so I don't have to delete the original owner's name that keeps popping up and put in my "u

  • Too much music?

    Hi. I've been trying to import all the music I have stored on my computer to iTunes, but somehow iTunes select only a part of it. Sometimes an error shows too, saying iTunes failed importing/copying :C-disc or something. Could it be that I have too m

  • My update failed and now my phone is frozen with the apple symbol

    I was updating my iPhone and it failed and now my phone is frozen with the Apple Icon.  It wont turn off or anything

  • Playing more than 1 video/podcast/movie in a row

    How can I use iTunes to play a whole series of movies/video podcasts at a time? I have a whole bunch of short films and video podcasts & wanna play one-after-another in iTunes. I cannot seem to get iTunes to do this for me. I wanna just sit back and

  • Remote Role Assignments - Different User Base

    Hi Federation gurus, I am working on a federated portal network and my consumer's UME is connected to the corporate LDAP (i.e. AD). All the producers (BI, SRM and ECC) have their UMEs connected to the ABAP system (i.e. CUA). The user ids are identica