ORA-29546: when deploying SQLJ stored procedures

Can anyone please help me? I consistently get this error when
trying to deploy my java stored procedures that use SQLJ:
ORA-29546: badly formed resource: Error:
java.io.InvalidClassException: [Ljava.lang.Object;; Serialization
incompatible with Externalization
Adrian
null                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

The server prcess failed to allocate more memory for large objects ( in Oldspace).
If you Google ORA-04030, you will see several recommendations to work around this.
The Java VM in the database already has HttpClient, i don't know why you are loading the Apache HttpClient but this might not be the surce of the problem.
Kuassi http://db360.blogspot.com

Similar Messages

  • When to use stored procedures

    We have a Java application for which the performance is very slow. For example, one particular screen takes 16 seconds to display. When we watch the Oracle database, we find that the application is issuing 23 separate queries to populate the screen (one query per display row). This screen could grow to need more rows in which case the application has been written to issue separate queries against the database for each. What is appropriate way for the application to obtain this data? We have written a stored procedure that takes .4 seconds to provide this data. When is a stored procedure appropriate? Are there any documents regarding best practices on this issue?

    Just out of interest, why avoid stored procedures at
    all costs? Are you joking, or is there a valid
    reason? Stored procedures are in general faster than
    using Statements.One reason would be because it limits the database portability, since not all databases support them.
    This is generally only a concern when writing product software for smaller companiers. Larger companies will use databases that support stored procs and are much less likely to want to migrate. And are much more likely to have DBAs who will insist on it as well.

  • ORA-04030: out of process memory when using Java Stored Procedures

    Hello,
    I have a problem using Java Stored Procedures in Oracle 10g.
    My Java application performs http posts to a webservice and the response is parsed in order to populate some DB tables.
    There is a scheduled job which calls the Java Stored Procedure every x minutes.
    No matter of the 'x minutes' values - after about 160 - 200 calls I get this error:
    ORA-04030: out of process memory when trying to allocate 1048620 bytes (joxp heap,f:OldSpace)
    ORA-04030: out of process memory when trying to allocate 2097196 bytes (joxp heap,f:OldSpace)
    The job stops just while is posting the http request. The weird thing is that almost each time the first http post request I get this error:
    java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
         at java.net.Socket.connect(Socket.java:426)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
         at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
         at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
         at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    and the second try works fine.
    So, The out of process memory occured each time just before getting such an error, and I suspect to be a connection between these errors.
    Tech details:
    1. OS: WinXP
    2. Oracle 10.1.0.2.0
    3. To perform http post I use HttpClient 3.1 from Apache.
    4. I checked the http connection to be closed each time, and this is done.
    5. I checked the oracle statement and connection to be closed each time and this is done
    6. The JVM error (logged in .trc files of Oracle) is:
    java.lang.OutOfMemoryError
         at java.lang.Thread.start(Native Method)
         at sun.security.provider.SeedGenerator$ThreadedSeedGenerator.run(SeedGenerator.java:297)
    DB Settings details:
    Starting up ORACLE RDBMS Version: 10.1.0.2.0.
    System parameters with non-default values:
    processes = 200
    sessions = 225
    shared_pool_size = 159383552
    large_pool_size = 8388608
    java_pool_size = 104857600
    nls_language = AMERICAN
    control_files = C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL03.CTL
    db_block_size = 8192
    db_cache_size = 29360128
    compatible = 10.1.0
    fal_client = XXXXXX
    fal_server = XXXXXXs
    log_buffer = 524288
    log_checkpoint_interval = 100000
    db_files = 70
    db_file_multiblock_read_count= 32
    db_recovery_file_dest = C:\oracle\product\10.1.0\flash_recovery_area
    db_recovery_file_dest_size= 2147483648
    standby_file_management = AUTO
    undo_management = AUTO
    undo_tablespace = undotbs_01
    undo_retention = 14400
    remote_login_passwordfile= EXCLUSIVE
    db_domain =
    dispatchers = (PROTOCOL=TCP) (SERVICE=XXXXXXXDB)
    remote_dependencies_mode = SIGNATURE
    job_queue_processes = 4
    parallel_max_servers = 5
    background_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\BDUMP
    user_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\UDUMP
    max_dump_file_size = 10240
    core_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\CDUMP
    sort_area_size = 1048576
    sort_area_retained_size = 1048576
    db_name = XXXXXX
    open_cursors = 500
    optimizer_mode = FIRST_ROWS
    pga_aggregate_target = 25165824
    Any help would be appreciated. Thanks.
    Can be a problem with JVM threading under Oracle ?

    The server prcess failed to allocate more memory for large objects ( in Oldspace).
    If you Google ORA-04030, you will see several recommendations to work around this.
    The Java VM in the database already has HttpClient, i don't know why you are loading the Apache HttpClient but this might not be the surce of the problem.
    Kuassi http://db360.blogspot.com

  • ORA-03115 error when calling a Stored Procedure

    Hi All,
    I'm in the process of porting a Pro/C app from NT to Linux. I've installed 8.1.5 on our Linux box and patched it up to 8.1.5.02.
    It all kind of works ok, except that I'm sometimes getting ORA-03115 errors when the app calls a stored procedure. The call in question looks like this:
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR resprows[50][3998];
    int numret = 0;
    int numrows= 50;
    int done= 0;
    unsigned long resp_id = 0;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL AT DB_NAME EXECUTE
    BEGIN pkg_something.getdata(
    :resp_id, /* IN */
    :numrows, /* IN */
    :done, /* OUT */
    :resprows, /* OUT */
    :numret /* OUT */
    END;
    END-EXEC;
    The stored procedure basically uses the resp_id value to select rows from a table;
    in each row there is a VARCHAR2(4000) column which it copies into the hostarray resprows.
    There may be anything from 1 to numrows returned from the SP.
    Initially, the resprows rows were defined to be size [4000]. Unfortunately, this caused ORA-02005 errors - I then changed the size to [3998], which seemed to fix the 02005's (although I'm unclear as to the reasons why).
    Now I'm getting the 03115 errors when calling the SP. The oracle manual is not very helpful on what this error means.
    This all works chipper on NT.
    Any ideas?
    Thanks in advance,
    Nigel.
    PS: The database the app is talking to is still hosted on NT.
    null

    Histon FTM wrote:
    ORA-04063: package body "LAZARUS.LAZARUS" has errors Above, obviously conflicts with the statement that follows:
    >
    The procedure and package have both compiled without errors and the statement on its own works fine in SQL*Plus.I suggest you take a look in the USER_ERRORS view to see, what the errors are.
    And just checking:
    You have schema called LAZARUS, which holds a package named LAZARUS, which holds a procedure called POPULATEGRIDPOSITIONS?
    Edited by: Toon Koppelaars on Oct 1, 2009 5:55 PM

  • ORA-21700 Error when running C# stored procedure to do a spatial query

    Hi All
    I'm having trouble running a C# stored procedure that (via another object) that falls over running a spatial query with the following error.
    OAR-21700 object does not exist or is marked for delete
    If I take the sql of the spatial query out and run it separately in SqlPlus it runs as expected.
    If I use the object that executes the spatial query via NUnit (i.e. executed on the client, rather than the server) it also works as expected.
    Can anyone help? Is there some issue using Oracle Spatial queries with the Oracle Database Extensions for .NET?

    I can indeed. Here is a slightly simplified version:
    SELECT secondary_catch.mi_prinx AS primarykey
    FROM mapinfo_data.secondary_catch
    WHERE sdo_relate (secondary_catch.geoloc,
    (SELECT geoloc
    FROM training_6.building_polygons
    WHERE building_id = 10002507117),
    'mask=anyinteract querytype=WINDOW'
    ) = 'TRUE'
    Interestingly, if I attempt to run this query inside a C# stored procedure using the implicit context connection (i.e. OracleConnection.ConnectionString = "context connection=true") it fails with the error I described above.
    If however I create a new connection and connect as a regular user on my database, the query works correctly.
    So in that sense I have a workaround, but I'd like to avoid using it if I can as creating a new explicit connection is an overhead I can do without.

  • Error deploying java stored procedure

    Anyway, I've got a really simple java function that takes an XML document in a CLOB as a parameter and simply returns whether or not it's a valid document. Works fine in JDeveloper, but when I try to load it into the database, I get:
    Errors in cdh_j_validate:
    ORA-29521: referenced name oracle/xml/parser/v2/DOMParser could not be found
    The XML Parser is installed on the database and is functioning properly.. I am deploying my Java stored procedure to the same schema that the xml parser was installed into. Any suggestions?
    Thanks in advance,
    Craig Drabik
    null

    This is due to a current restriction in the loadjava utility. The following is the excerpt from the Release notes on the subject:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
    Incomplete Deployment to Oracle8i When Using JDBC Thin Driver and Net8 Name-value List (1250825)
    In the Connection Manager, it is possible to create a connection to Oracle 8i using the Oracle JDBC Thin driver and Net8 name-value pairs as the connection method. This connection can be viewed in the Database Browser, but deployment will not complete because the loadjava utility requires a database string of the form "@host:port:SID" when using the Oracle JDBC Thin driver.
    There are two work-arounds to this problem:
    Use the Named Host connection method instead of Net Name-Value Pair when creating this connection type in the Connection Manager.
    Use the Oracle JDBC OCI-8 driver instead of the Oracle JDBC Thin driver. To use the Oracle JDBC OCI-8 driver with JDeveloper, please see the section entitled 'Connection Requirements for OCI and Type 2 JDBC Drivers' in the online documentation.
    <HR></BLOCKQUOTE>
    -- Brian

  • Failure of EXECUTE IMMEDIATE when in a stored procedure

    Hello,
    this concerns behaviour observed in Oracle 10g on Windows.
    As user "system", I execute from the command line the following:
    SQL> select COUNT(1) from sys.dba_sequences;
    COUNT(1)
    645
    Again I try the same thing from the command line:
    SQL> declare
    2 CNT INTEGER:=0;
    3 STMT VARCHAR2(300);
    4 BEGIN
    5 STMT:='select COUNT(1) from SYS.DBA_SEQUENCES';
    6 EXECUTE IMMEDIATE STMT INTO CNT;
    7 dbms_output.put_line('CNT='||CNT);
    8 end;
    9 /
    CNT=645
    So far so good, clearly this table exists and I have sufficient privileges to access SYS.DBA_SEQUENCES as user system.
    However, if I put this in a stored procedure in a script TEST_SEQ.sql and then execute, I get ORA-00942:
    1. Create or replace Procedure TEST_A1
    2. IS
    3. CNT INTEGER:=0;
    4. STMT VARCHAR2(300);
    5.
    6. BEGIN
    7. STMT:='select COUNT(1) from SYS.DBA_SEQUENCES';
    8.     EXECUTE IMMEDIATE STMT INTO CNT;
    9.     dbms_output.put_line('CNT='||CNT);
    10. END;
    SQL> @ TEST_SEQ.sql
    SQL> exec TEST_A1;
    ORA-00942: Table or view does not exist
    ORA-06512: At "SYSTEM.TEST_A1", line 8
    ORA-06512: At line 1
    Why now does this table not seem to exist when accessed from a stored procedure?

    http://www.google.com/search?btnG=1&q=ora-0942+procedure
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who do read documentation.

  • PLS-00201 error occurs when batching a stored procedure in SQL*Plus

    I have a batch file to run a stored procedure and spool the results to file. When I enter the commands manually in sql*plus the output works fine and my results are spooled to the output file. But when I run the same commands in the batched script I get an error.
    Any ideas?
    Stored Procedure:
    create or replace procedure MMP( p_cursor in out SYS_REFCURSOR)
    as
    begin
    open p_cursorfor select name, id from table;
    end;
    batch file 1:
    sqlplus -S user/pw@REPORTDV @sp_output_spooled.sql
    script file sp_output_spooled.sql
    Pasting these commands directly to the SQL*Plus command prompt spools the result set to file as expected.
    set colsep '|'
    set echo off
    set feedback off
    set termout off
    set heading off
    set linesize 9000
    set pagesize 0
    set trimspool on
    set headsep off
    spool output.TXT
    var rc refcursor
    execute MMP(:rc)
    print rc
    spool off
    exit
    The errors printed to output.TXT file after the batch is run and error occurs:
    BEGIN MMP(:rc); END;
    ERROR at line 1:
    ORA-06550: line 1, column 8:
    PLS-00201: identifier 'MMP' must be declared
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "rc"

    Hi,
    Your code worked fine for me.
    Is MMP procedure owned by the same user that is running the batch file or does it have proper privileges and synonym?
    vr,
    Sudhakar

  • SQL Developer Bug: NVL() function error when debug/run stored procedure

    Version:
    SQL Developer: 1.5.3 (build main-5783)
    Oracle DB connected: Oracle9i Enterprise Edition Release 9.2.0.6.0
    Stored procedure code like this:
    procedure search(V_STATUS_IN IN CHAR(1)) is
    begin
    declare
    V_STATUS CHAR(1) := NULL;
    begin
    V_STATUS := NVL(V_STATUS_IN, '%'); -- error line
    end;
    end;
    The stored procedure runs well (I mean no oracle exception) when called through Java code (and in TOAD). But when debug/run in SQL Developer, following error at the error line:
    $Oracle.EXCEPTION_ORA_6502:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    --------------------------------------------------*/

    What parameter are you passing in? It is possible you are trying to cram a multibyte character into a singlebyte container. What are the nls settings for the database and for sqldeveloper?

  • Question about MySQL, JDBC, SQLJ, Stored procedure & callable statements

    Hi, there. I'm using j2sdk1.4.1_01 and MySQL ver 12.18 Distrib 4.0.12, and when I try to install a store procedure, it throws the following message:
    SQLException: Stored procedures not supported: {call sqlj.install_jar('blah...blah...MyProject-20031206.jar', 'routines_jar', 0)}
    Who's is not supporting store procedures here? Java or MySQL? What can I do?
    The book and sample code I'm using as a reference mention that "the sample code assumes that the DBMS already stores the built-in SQLJ procedure sqlj.install_jar, which loads a set of classes written in the Java programming language in an SQL system". Now my question is: the "SQLJ procedure sqlj.install_jar" is something extra that I need to install or it has nothing to do with the problem?
    Is it true that MySQL does not support stored procedures? Thank you in advance for any hint or suggestion.
    Regards,
    Hector.

    Who's is not supporting store procedures here? Java or
    MySQL?MySQL.
    What can I do?1. Don't use stored procedures.
    2. Use a database that supports stored procedures.
    3. Wait for the release of MySQL that does support stored procedures.

  • Ora-06550 returning data from Stored Procedure and Entity Data Model

    Hi.
    I'm creating an application that uses a WCF Service to return data. I also created a proyect with the EDMX design and mapped most of my DBModel to a classes context. I have added some of the procedures as well. One of them receive some parameters and return a Sys_RefCursor, that is populated according to the parameters.
    I have declared the "<add >" tags in the Web.Config and imported the function of the Procedure. When I call the Asyncronous function I get different exceptions:
    1. If I call the function, with all of the parameters i get:
    Oracle.DataAccess.Client.OracleException: ORA-06550: línea 1, columna 8:
    PLS-00306: número o tipos de argumentos erróneos al llamar a
    'SP_HECHOSJURITER'
    ORA-06550: línea 1, columna 8:
    (wrong number or types of arguments in call to 'SP_HECHOSJURITER')
    2. If i just set 1 parameter in the SP, returning the same type of data, I get:
    Error al recibir la respuesta HTTP a
    http://localhost/Procalculo.CGFM.SIGOC.DatosServices/ServiceDatos.svc.
    (failed to receive http response. error 12152)
    3. If I don't set any parameters in the procedure, it works fine, and return correct data.
    It exclusively happen with one entity.
    Any clue?
    I appreciate any help.

    When you return result sets from stored procedures to Entity Framework, you are very likely using implicit result sets. Implicit result sets don't need to be declared as a parameter in code, only in the <add> tags to define the metadata in the .NET config file.
    For example, in the EF Oracle By Example, you'll see that the stored procedure in the function import has three parameters, but only two are declared in the code. The third one was defined in the config file.
    http://download.oracle.com/oll/obe/EntityFrameworkOBE/EntityFrameworkOBE.htm

  • Error ORA-04031 while executing a stored procedure from Pro C++ code

    I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
    Does anyone know why it is happening and any possible solutions?
    TIA
    Srithaj.

    One thing that can be done is to flush the shared pool before starting the application.
    alter system flush shared pool;
    Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
    null

  • Error when calling a stored procedure from a SQL Script

    Apologies if this is a really dumb question but I can't seem to call a procedure in package from a SQL script. I have a simple package.procedure containing a loop to populate a table. I would like to include a call to this procedure from my database install script, that also includes my CREATE and INSERT statements. I run the script using "@install_databae" and the CREATE and INSERT statements run fine. The script gives an error when it reaches the line below:
    exec lazarus.PopulateGridPositions;
    and gives the error.....
    BEGIN lazarus.PopulateGridPositions; END;
    ERROR at line 1:
    ORA-04063: package body "LAZARUS.LAZARUS" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "LAZARUS.LAZARUS"
    ORA-06512: at line 1
    The procedure and package have both compiled without errors and the statement on its own works fine in SQL*Plus.
    I've obviously missed some fundamental concept with scripts and SQL. Please can anybody help me?

    Histon FTM wrote:
    ORA-04063: package body "LAZARUS.LAZARUS" has errors Above, obviously conflicts with the statement that follows:
    >
    The procedure and package have both compiled without errors and the statement on its own works fine in SQL*Plus.I suggest you take a look in the USER_ERRORS view to see, what the errors are.
    And just checking:
    You have schema called LAZARUS, which holds a package named LAZARUS, which holds a procedure called POPULATEGRIDPOSITIONS?
    Edited by: Toon Koppelaars on Oct 1, 2009 5:55 PM

  • ORA-01861 on call to stored procedure

    I'm trying to pass a date type to stored procedure and I get this error. Here's my code any help would be GREATLY appreciated!
    Dim expiresParam As OracleParameter = command.Parameters.Add("expires", OracleDbType.Date)
    expiresParam.Direction = ParameterDirection.Input
    Dim od As OracleDate = New OracleDate(expires)
    expiresParam.Value = od
    Expires is defined as ByVal expires As System.DateTime

    I changed the date field to a varchar2 field and I still get an ORA-01861 - any ideas what causes this on a called to a stored proc? Here's the entire code snippet
    Protected Shared Function SprocCreateSecurityToken(ByVal token As String, ByVal expires As System.DateTime, ByVal MachineName As String, _
    ByVal UserName As String, ByVal EmployeeNo As Integer) As Integer
    ' create a connection...
    Dim connection As New OracleConnection(ULLOSPApplication.Application.ConnectionString)
    connection.Open()
    ' create a command...
    Dim command As New OracleCommand("dps_eppv4_package.CREATE_SECURITY_TOKEN", connection)
    command.CommandType = CommandType.StoredProcedure
    ' parameters...
    Dim tokenParam As OracleParameter = command.Parameters.Add("Token", OracleDbType.Varchar2, 256)
    tokenParam.Direction = ParameterDirection.Input
    tokenParam.Value = token
    'Dim expiresParam As OracleParameter = command.Parameters.Add("expires", OracleDbType.Date, 20)
    'expiresParam.Direction = ParameterDirection.Input
    'Dim od As OracleDate = New OracleDate(expires)
    'expiresParam.Value = od
    Dim expiresParam As OracleParameter = command.Parameters.Add("expires", OracleDbType.Varchar2, 20)
    expiresParam.Direction = ParameterDirection.Input
    expiresParam.Value = expires.ToString
    Dim MachineNameParam As OracleParameter = command.Parameters.Add("MachineName", OracleDbType.Varchar2, 64)
    MachineNameParam.Direction = ParameterDirection.Input
    'MachineNameParam.Value = MachineName
    MachineNameParam.Value = "123"
    Dim UserNameParam As OracleParameter = command.Parameters.Add("UserName", OracleDbType.Varchar2, 64)
    UserNameParam.Direction = ParameterDirection.Input
    UserNameParam.Value = UserName
    Dim EmployeeNoParam As OracleParameter = command.Parameters.Add("EmployeeNo", OracleDbType.Int64, 6)
    EmployeeNoParam.Direction = ParameterDirection.Input
    EmployeeNoParam.Value = EmployeeNo
    Dim returnValueParam As OracleParameter = command.Parameters.Add("RETVAL", OracleDbType.Int64)
    returnValueParam.Direction = ParameterDirection.ReturnValue
    ' execute...
    command.ExecuteNonQuery()
    ' cleanup...
    command.Dispose()
    connection.Close()
    ' return...
    Return CInt(returnValueParam.Value)
    End Function
    The exception is returned on the ExecuteNonQuery

  • Error message display for me"invalid colmun " when i implement stored procedure

    Hi guys
    in this stored procedure below i have proplem in colmun in sex type i have two values Male and female
    but when i search by this colmun from interface it give me invalid colmun why
    this is my stored procedure
    Create Procedure sp_Employee
        @EmployeeID       NVARCHAR(50),
        @EmployeeName     NVarchar(100),
        @SexType          Nvarchar(50)
    AS
    Declare @SQLQuery as nvarchar(2000)
    SET @SQLQuery ='SELECT * from ViewEmpTEST Where (1=1)'
     If @EmployeeID <>''
             Set @SQLQuery = @SQLQuery + 'And (EmployeeID = '+ @EmployeeID+') '
    If @EmplyeeName  <>''
             Set @SQLQuery = @SQLQuery + ' AND (EmplyeeName  LIKE
    N''%'+@EmplyeeName +'%'') '
    If @SexType <>''
              Set @SQLQuery = @SQLQuery + 'And (SexType = '+ @SexType+') '
    Exec (@SQLQuery)
    and this is my view ViewEmpTEST
    SELECT     CONVERT(varchar, dbo.Employee.DriverID) AS EmployeeID, dbo.Employee.EmplyeeName, dbo.Employee.DriverName,
                          dbo.Nationality.NationalityName, dbo.Employee.ResidentNo, dbo.Country.CountryName, dbo.Branch.BranchName, dbo.Employee.ResignDate,
                          dbo.Employee.HealthCarNo, dbo.Jobs.JobName, dbo.Department.DepartmentName, dbo.Employee.PlaceIssue, dbo.Employee.Deduction,
                          dbo.Employee.ExpireDateMedical, dbo.Employee.PolicyNumber, dbo.Employee.ExpireDateResident, dbo.Miritial.MiritualStatus,
                          dbo.Status.StatusType, dbo.Sex.SexType, dbo.Employee.UnactiveReason, CONVERT(varchar, dbo.Employee.BirthDate, 103) AS BirthDate,
                          CONVERT(varchar, dbo.Employee.DateToday, 103) AS DateToday, dbo.Employee.UserID, dbo.Employee.PassportNo, dbo.Employee.Bonus,
                          dbo.Employee.AccountType, dbo.Employee.PlaceOfBirth, dbo.Employee.ExpireDateresidentHijri, CONVERT(varchar, dbo.Employee.PassportDateStart,
                          103) AS PassportDateStart, dbo.Employee.PassportDateExpire, dbo.Employee.EntryNo, dbo.Employee.PlacePassport, CONVERT(varchar,
                          dbo.Employee.Salary) AS Salary, dbo.Employee.AccountNo, dbo.Religon.ReligonName, dbo.Employee.Mobile, dbo.Employee.Email,
                          CONVERT(varchar, dbo.Employee.SexID, 103) AS SexID, CONVERT(VARCHAR, dbo.Employee.StatusID, 103) AS StatusID, dbo.Employee.JoinDate,
                          dbo.Employee.JobDetailes, dbo.BloodType.BloodType, dbo.Class.ClassName, dbo.Employee.OccupationID, dbo.Ocuppation.OcuppationName
    FROM         dbo.Employee LEFT OUTER JOIN
                          dbo.Ocuppation ON dbo.Ocuppation.OccupationID = dbo.Employee.OccupationID LEFT OUTER JOIN
                          dbo.BloodType ON dbo.BloodType.BloodID = dbo.Employee.BloodID LEFT OUTER JOIN
                          dbo.Class ON dbo.Class.ClassID = dbo.Employee.ClassID LEFT OUTER JOIN
                          dbo.Department INNER JOIN
                          dbo.Jobs ON dbo.Department.DepartmentID = dbo.Jobs.DepartmentID ON dbo.Employee.JobID = dbo.Jobs.JobID LEFT OUTER JOIN
                          dbo.Miritial ON dbo.Miritial.MiritialID = dbo.Employee.MiritialID LEFT OUTER JOIN
                          dbo.Branch ON dbo.Branch.BranchID = dbo.Employee.BranchID LEFT OUTER JOIN
                          dbo.Status ON dbo.Status.StatusID = dbo.Employee.StatusID LEFT OUTER JOIN
                          dbo.Sex ON dbo.Sex.SexID = dbo.Employee.SexID LEFT OUTER JOIN
                          dbo.Religon ON dbo.Religon.ReligonID = dbo.Employee.ReligonID LEFT OUTER JOIN
                          dbo.Country ON dbo.Country.CountryID = dbo.Employee.CountryID LEFT OUTER JOIN
                          dbo.Nationality ON dbo.Nationality.NationalityID = dbo.Employee.NationalityID
    WHERE     (dbo.Nationality.NationalityID IS NULL) OR
                          (dbo.Nationality.NationalityID IS NOT NULL) OR
                          (dbo.Country.CountryID IS NULL) OR
                          (dbo.Country.CountryID IS NOT NULL) OR
                          (dbo.Jobs.JobID IS NULL) OR
                          (dbo.Jobs.JobID IS NOT NULL) OR
                          (dbo.Miritial.MiritialID IS NULL) OR
                          (dbo.Miritial.MiritialID IS NOT NULL) OR
                          (dbo.Branch.BranchID IS NULL) OR
                          (dbo.Branch.BranchID IS NOT NULL) OR
                          (dbo.Status.StatusID IS NULL) OR
                          (dbo.Status.StatusID IS NOT NULL) OR
                          (dbo.Sex.SexID IS NULL) OR
                          (dbo.Sex.SexID IS NOT NULL) OR
                          (dbo.Class.ClassID IS NULL) OR
                          (dbo.Class.ClassID IS NOT NULL) OR
                          (dbo.Ocuppation.OccupationID IS NULL) OR
                          (dbo.Ocuppation.OccupationID IS NOT NULL) OR
                          (dbo.BloodType.BloodID IS NULL) OR
                          (dbo.BloodType.BloodID IS NOT NULL)
    what is the proplem in statment sextype in stored procedure

    Start over - completely.  The tsql for your view is poorly written. 
    One does not have a sex, one has a GENDER. 
    I can understand a conversion of datatype like "CONVERT(varchar, dbo.Employee.DateToday, 103) AS DateToday", but not "CONVERT(varchar, dbo.Employee.SexID, 103) " - style 103 is for datetime datatypes and the column name SexID does not
    remotely imply that datatype. 
    Similarly, stop being so lazy and specify the length of your converted varchar column rather than allowing it to default to some length.  And if you are going to convert to varchar, shouldn't you be converting to nvarchar given that your procedure
    arguments are nvarchar?  Consistency will only help your code stability and correctness.
    To continue with the datetime to varchar conversion, is this an attempt to simply strip the time component from a column that is datetime?  If so, simply convert it to date and avoid any possibility of error due to interpretation assumptions with the
    converted string and its format.
    Lastly, do you really need all of those outer joins?  I find it difficult to believe that an employee does not have a required relationship with a majority of those tables.
    As for your problem, please post the complete and entire error message - exactly as displayed.  Presumably you have performed a basic test of your view and verified that it still works (i.e., nothing was changed about the tables involved in the view
    after the view was created).  Something like "select top 1 * from dbo.ViewEmpTEST where SexType = 'x';" should execute successfully and return an empty resultset. 
    And, of course, the SexType column is (presumably) nvarchar, so you will need to enclose the value you are searching for in your dynamic sql with single quotes.  If you intend to provide dynamic searching functionality, you will need to learn to code
    it and debug it yourself.  The others have already indicated that this approach is a security-risk.  At the very least, you should capture the string that you are attempting to execute and visually examine it yourself when you discover that
    it does not work.  It will then become obvious (assuming the code you currently have posted is what you are using) that the error is your inclusion of the SexType argument in the string:
    select ... where ... And (SexType = male)

Maybe you are looking for