Issuing a simple EXECUTE command using ODP

I want to issue a command using ODP in C# to refresh a materialized view.
The command I want to execute is simple: EXECUTE DBMS_MVIEW.REFRESH('USER.MV_TEST','C');
I have tried with and without the anonymous block BEGIN..END. I have tried issuing it as cmd.ExecuteNonQuery() and cmd.ExecuteReader(), but I always get an error.
Here is the basic C# source code:
con.ConnectionString = "User Id=user;Password=123;Data Source=oracle;";
string cmdQuery = "BEGIN EXECUTE DBMS_MVIEW.REFRESH('USER.MV_TEST','C'); END;";
OracleCommand cmd = new OracleCommand(cmdQuery);
con.Open();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
Anyone know what the problem is?
Thanks

Hi,
Execute is a sqlplus command.
Try
string cmdQuery = "BEGIN DBMS_MVIEW.REFRESH('USER.MV_TEST','C'); END;";
Cheers,
Greg

Similar Messages

  • Spanish characters getting garbled while executing command using Java code

    Hi,
    I try to execute a command using java code. output of the command contains spanish characters. Few of these characters getting garbled after the command execution.
    Runtime r = Runtime.getRuntime();
              Process p = null;
    String pgm="ipconfig /all";
              try
                        p = r.exec(pgm);
    BufferedReader br=new BufferedReader(new InputStreamReader
                                  (p.getInputStream()));
    while((val = br.readLine()) != null){ System.out.println(val);
              catch (Exception e)
                        return (null);
    I tried to run the code using -Duser.language=es -Duser.region=ES -Dfile.encoding=Cp850, but this did nt help. I could see the outputs properly in command prompt,
    If i redirect the output to a text file , it is getting garbled,
    Please let me know to solve this issue.

    884543 wrote:
    Hi,
    I try to execute a command using java code. output of the command contains spanish characters. Few of these characters getting garbled after the command execution.
    Runtime r = Runtime.getRuntime();
              Process p = null;
    String pgm="ipconfig /all";
              try
                        p = r.exec(pgm);
    BufferedReader br=new BufferedReader(new InputStreamReader
                                  (p.getInputStream()));
    while((val = br.readLine()) != null){ System.out.println(val);
              catch (Exception e)
                        return (null);
    I tried to run the code using -Duser.language=es -Duser.region=ES -Dfile.encoding=Cp850, but this did nt help. I could see the outputs properly in command prompt,
    If i redirect the output to a text file , it is getting garbled,
    Please let me know to solve this issue.Set the character set to UTF-8 to your InputStreamReader, for More details on usage refer the java api :
    http://download.oracle.com/javase/6/docs/api/java/io/InputStreamReader.html

  • Executing a command using Runtime Class

    How to execute a command on a differnet machine with different ipaddress using Runtime Class
    My code is
    String[] cmd = new String[3];
    cmd[0] = "192.1...../c:/WINNT/system32/cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1]
    + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    This is not Working

    I have same issue. Actually when I use cmd.exe /c set in java code and if I run the java code in DOS propmt, it retrieves all latest user Environment variable values. But if I run the code in windows batch file, it is not retrieveing the latest user environment values until I reboot my computer, Do you know how to get user environment value with out rebooting machine??????

  • Problem in using JDBC Execute commands(Update & Delete Only) with af:Table

    HI Everyone,
    I have one issue with Updating and Deleting Row Data using JDBC Execute commands.
    Suppose In My Application i have two pages, in Page 1 I have Two Command Buttons(Delete and Save) and One Input TextBox to write the String to be stored in the Database. and Page 2 where the result Table is shown and table is binded with a ViewObject, Now When User Types some String in InTB and click Save then By Programmatically I'm searching, that string is already present in database or not, if it is already exist then Save button converts in Update button and instead of inserting it allows user to Update the String already exist in database.
    Everything is working fine but the problem comes when i put those all buttons on the same page where result table is present.After putting all things on the same page and When i click save button to insert new String it is Successfully inserting but when any of other action is performed like updating or Deleting the existing one.. then my application just hanged and then nothing I able to do.
    Please Help me to understand this problem and give me the solution for this..
    Thanks
    Fizzz...

    Hi frank,
    Thanks to reply me...
    I'm refreshing table's iterator on each command button's action to reflect the changed result... and i'm sorry i mentioned two pages in my project.. actually these are two forms in the same page..which conditionally changed its renderer properties.. its working fine when only one form is renderred and the otherside when both are rendered then it is not working.
    Hope this change will help you to understand the problem.. if something else you are looking for then please tell me..
    Thanks
    Fizzz...

  • Using AppleScript "execute" command in Acrobat

    Acrobat's scripting dictionary has a cryptic description of an "execute" command that is supposed to execute a menu item "as if a user clicked it".
    No information is given as to how to identify the desired menu command except "reference". Huh? Is there documentation or a tutorial on this anywhere?
    Related question, how can AppleScript identify auxiliary windows such as the Document Properties window and its various button bar items and other fields?
    Here's one simple thing I'm trying to accomplish: I'm using System Events to script some items like keywords in the Document Properties window. Sometimes it takes several seconds for a document to open. Without putting in huge wait loops, I'd like to execute the menu item "File: Properties..." and then wait for the window to open using a loop like this:
    repeat until exists <some way to identify the Document Properties window>
    end repeat
    Any hope of doing stuff like this? I already tore out enough hair trying to get AppleScript's "do script" command to work (only lately having discovered that the script file apparently must be plain text, no Unicode).

    The Macintosh keyboard does not have a true "Enter" key any more - not on the MacBook Pro or the iBooks. Modifier keys do not seem to work either. I've turned on the System Prefs > Keyboard & made it appear in the top Menu Bar. From this menu choose "Show Keyboard Viewer" to see how keys + Return are displayed. Only the Function key changes the Return key. Function + Delete is a forward delete. But Function + Return is just another Return. So any highlighted text is deleted! Command + Return stays on the same line and selected text remains. I will try KeyRemap4MacBook utility then consider buying a USB numeric keypad. Urggh.

  • Could not execute command "getState" for server server01 using nodemanager

    Hi,
    I have built a weblogic 9.1 env with 2 managed servers running on different boxes from the admin server.
    I am having problems in starting the managed servers using the nodemanager. I get the following error message in the Admin server log:
    <Error> <NodeManager> <BEA-300034> <Could not execute command "getState" for server "******" using the node manager. Reason: I/O error while reading domain directory: java.io.FileNotFoundException: Domain directory '/opt/bea/weblogic91/common/nodemanager' invalid (domain salt file not found).>
    I get the following message on the admin console:
    For server ******, the Node Manager associated with machine ******-machine is not reachable.
    All of the servers selected are currently in a state which is incompatible with this operation or are not associated with a running Node Manager. No action will be performed.
    I can start the managed server using the "startMangedWeblogic.sh" without any issues.
    Any help on this would be greatly appreciated.
    Thanks

    one more thing to add:
    I get the following error in the Managed server log:
    <I/O error while reading domain directory: java.io.FileNotFoundException: Domain directory '/opt/bea/weblogic91/common/nodemanager' invalid (domain salt file not found)>
    java.io.FileNotFoundException: Domain directory '/opt/bea/weblogic91/common/nodemanager' invalid (domain salt file not found)
    at weblogic.nodemanager.server.DomainManager.initialize(DomainManager.java:74)
    at weblogic.nodemanager.server.DomainManager.<init>(DomainManager.java:46)
    at weblogic.nodemanager.server.NMServer.getDomainManager(NMServer.java:239)
    at weblogic.nodemanager.server.Handler.handleDomain(Handler.java:170)
    at weblogic.nodemanager.server.Handler.handleCommand(Handler.java:104)
    at weblogic.nodemanager.server.Handler.run(Handler.java:64)
    at java.lang.Thread.run(Thread.java:595)

  • Executing a simple assembly program using legion

    How do I execute a simple assembly program using Legion simulator and view the registers?

    I tracked down the problem and it is a race condition between the many processes being started up. A smaller delay should also solve the problem. Or, maybe do something else before the first 'load'. The 'load' command tries to launch systembuild and causes the race condition.

  • Problem while executing a command using exec()

    I'm trying to execute a command on Unix O/S with the help of java program. For this I have used Runtime class available in java.lang. It works fine for some of the basic unix commands like 'ls','cp' but when I tried to execute command "sqlldr userid=<user>/<pwd> control=/u01/dw/snb/log/sp_shd05721_ins_stg_sqlldr.ctl" , then it's not getting executed. Please advise.

    You may be having a problem with the command path, which I don't think Runtime.exec() uses. Try specifying the full path

  • Re: Error while Execute External Operating System Command using T.code SM49

    Dear Experts,
    I Have uploaded one .exe file in the application server (eg: sum.exe) and created the OS command in SM69 transaction .
    And maintained the application server path in the 'operating system command' field in SM69 t.code.
    Our SAP system, oprating system is UNIX.
    After I have executed the external command using transaction SM49 , but I got the below error.
    Can not execute external program (permission denied) , External program terminated with exit code 1
    Immediately I run the SU53 transaction code to check the authorization, but Authorization was successful.
    Could any one please help on this error.
    Thanks in advance.

    >>Can not execute external program (permission denied) , External program terminated with exit code 1
    You need to give the permission as 755 to your file.
    >>I Have uploaded one .exe file in the application server (eg: sum.exe)
    You are on UNIX and do not expect to any result of .exe file as UNIX doesn't know about this.

  • Using the " character in a to be executed command (EMM)

    Hi,
    I ran against a small challange building a feature in a EMM based menu.
    I would like to have an user to change the number dialed in a chat-script but the chat-script command uses the character " in it's command.
    The same character " is also used to mark the beginning and the end in the <IOSExecCommand> and the <IOSConfigCommand>.
    When executing the feature it give's an error message back stating: EMM TCL Error: extra characters after close-quot.
    Which is not weird because there are a lot of " in the command line and normally you can put multiple command-lines in a single ExecCommand - or ConfigCommand line to mark the beginning and the end of a single command-line.
    According to TCL language script you could write the character " as \" or \\" but neither one of them does the trick to make it work.
    The ConfigCommand I want to execute looks like this:
    <IOSConfigCommand>"no chat-script internet " "chat-script internet "" "ATDT*98*2#" TIMEOUT 60 CONNECT"</IOSConfigCommand>
    Does anyone have an idea how to solve this?
    I'm kind of stuck with it.
    Kind regards,
    Jorn van Riel

    Instead of using IOSConfigCommand, use EmbeddedTCL instead.  For example:
          ios_config "no chat-script internet" {chat-script internet "" "ATDT*98*2#" TIMEOUT 60 CONNECT} 

  • Execute unix command using java

    Hello
    Can we execute a unix command using java? If it is how we can execute. Is this affect the performance of the program.
    Thanks

    I tried what you said. But its not working and returning error message,
    java.io.IOException: CreateProcess: ls -a error=2
         at java.lang.ProcessImpl.create(Native Method)
         at java.lang.ProcessImpl.<init>(Unknown Source)
         at java.lang.ProcessImpl.start(Unknown Source)
         at java.lang.ProcessBuilder.start(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
    If i try this statement,
    Runtime.getRuntime().exec("c\windows\notepad");
    It is working fine.
    Any idea about this.
    Plz ...........

  • To execute external command using   RFC_REMOTE_exec

    Hi
    i want to execute the ext command using RFC_REMOTE_EXEC .
    i have used like below in WINDOWS XP:
    data: v_cmnd(120) type C VALUE 'dir C:\SAP\rfcsdk\bin >RFEXEC -D ESM_R'.
    call function 'RFC_REMOTE_EXEC' destination D_DESTI
    exporting
    command = v_cmnd
    exceptions
    system_failure = 1 message D_ERMSG
    communication_failure = 2 message D_ERMSG.
    manually at command line the program getting registerd but
    not throuergh RFC_REMOTE_EXEC 
    in v_cmnd  what is the exact value we have to give
    Regards

    you create the command in SM69 with some name and Directly give the Same name when you are executing.
    Check this Function also.
    SXPG_COMMAND_EXECUTE

  • Error when executing scenario use command prompt - startscen

    Hi All,
    Anyone know how to solve this error? I get this error message when I execute command prompt: startscen scenarioName version001 contextDevelopment "-v=2"
    The error message is:
    java.lang.NullPointerException
    at com.sunopsis.g.a.f.b(f.java)
    at com.sunopsis.tools.core.SnpsStringTools.a(SnpsStringTools.java)
    at com.sunopsis.dwg.DwgObject.snpsDecypher(DwgObject.java)
    at com.sunopsis.dwg.DwgJv.treatCmd(DwgJv.java)
    at com.sunopsis.dwg.DwgJv.main(DwgJv.java)
    at oracle.odi.Agent.main(Agent.java)
    I use JDK version 1.4.
    Thanks in advance.
    Regards,
    Sumardi

    Hi Sumardi,
    Trying to help you,
    Please cross check the repository configuration information in ODIPARAM.BAT file.
    Thanks,
    G

  • How to execute a cvs command using System Call?

    hi all,
    how to execute a cvs login command using system call ?
    thanks,
    dam

    To anyone that reached this post and still dont have a hint, try this small sample - it logs on CVS using installed CVSNT and execute a fake update:
    package testeCVS;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    public class execCMD
        String password="yourPassword";
        String directory="C:\\CVS\\yourPathToProject";
        //send commands to CVS and shows the resulting screen
        public int sendCMD(String[] command) throws IOException, InterruptedException
            ProcessBuilder pb = new ProcessBuilder(command);
            pb.directory(new File(directory));
            pb.redirectErrorStream(true); // merge stdout and stderr
            Process p = pb.start();
            InputStreamReader isr = new  InputStreamReader(p.getInputStream());
            BufferedReader br = new BufferedReader(isr);
            String lineRead;
            StringBuilder buffer=new StringBuilder();
            System.out.println("Return of shell:");
            while ((lineRead = br.readLine()) != null)
                buffer.append(lineRead + "\n");
            System.out.println(buffer.toString());
            return p.waitFor();
        //send commands to CVS, send the password after the prompt and show the resulting screen
        public int sendDialogCMD(String[] command) throws IOException, InterruptedException
            ProcessBuilder pb = new ProcessBuilder(command);
            pb.directory(new File(directory));
            pb.redirectErrorStream(true); // merge stdout and stderr
            Process p = pb.start();
            PrintWriter writer = new PrintWriter( new OutputStreamWriter( p.getOutputStream() ));
            writer.println( password );
            writer.flush();
            InputStreamReader isr = new  InputStreamReader(p.getInputStream());
            BufferedReader br = new BufferedReader(isr);
            String lineRead;
            StringBuilder buffer=new StringBuilder();
            System.out.println("Return of shell:");
            while ((lineRead = br.readLine()) != null)
                buffer.append(lineRead + "\n");
            System.out.println(buffer.toString());
            return  p.waitFor();
        public static void main(String a[]) throws IOException, InterruptedException
            execCMD e=new execCMD();
            String[] command = new String[5];
            command[0] = "cvs";
            command[1] = "-q";
            command[2] = "-d";
            command[3] = ":pserver:yourUserID@localhost:2402/path/of/yourProject"; //in this case using CVS port 2402
            command[4] = "login";
            System.out.println("exit value=" + e.sendDialogCMD(command));
            command = new String[8];
            command[0] = "cvs";
            command[1] = "-q";
            command[2] = "-d";
            command[3] = ":pserver:yourUserID@localhost:2402/path/of/yourProject";
            command[4] = "-n";
            command[5] = "-q";
            command[6] = "update";
            command[7] = "-dA";
            System.out.println("exit value=" + e.sendCMD(command));
    }It is possible to send the password on the same command, but I had problems when the password had the character '@' because CVSNT took it as the separator between the username and server name. In that case the command is: ":pserver:yourUserID:yourPassword@localhost:2402/path/of/yourProject"

  • Issue in Selection Screen of ABAP report after executing it using TCode

    Hi,
    I have one Z program having a selection screen for it. One selection variable is non editable for the users (has default value) whereas user can enter the value in other selection variable.
    To make the first variable non editable, I have used the following code.
    INITIALIZATION.
      LOOP AT SCREEN.
        IF screen-name = 'P_USER'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Now when I execute this program from SE38, it works fine. But when I execute it using a Tcode (assigned in SE93), the first variable also become editable for users.
    How can I keep the first variable non editable even after executing the program using a Tcode?
    Regards,
    Yogesh

    Hi,
    It seems you create a Transaction type: Dialog transaction.
    Delete current transaction and create one with Transaction type: Report transaction (radio button in row 2nd)
    regards,

Maybe you are looking for