Store procedure to be triggered before approval procedure.

Dear Experts,
This is with reference to Approval Procedure and store procedure. I have created the store procedure which validates the series with user defined field value.
If there is difference in the field value of series & user defined field, system will block the entry ( this is defined in store procedure) & also approval procedure is also defined for the same document (i.e. Document value greater than 1 Lakh).
Now the problem, on creation of documents system trigger the Approval procedure and the document is sent for approval; but the store procedure defined is not reflected before approval & after the approval user cannot change series.
Is there any way the store procedure can validate the value before approval procedure is triggered?
Thanks & Regards,
Yogesh Jadav.

Hi Raj,
Below are the queries for Purchase Order & Purchase Order Draft.
Purchase Order Draft----
if @object_type='22' and (@transaction_type='A' or @transaction_type='U')
begin
if exists(select T0.docentry from odrf T0 inner join NNM1 T1 on T0.series=T1.series where (T1.seriesname like 'Ord%') and (T0.U_Stage<>'Order') and t0.objtype='22' and T0.docentry=@list_of_cols_val_tab_del)
begin
select @error=1, @error_message='Series name and category should be both order'
end
end
Purchase Order----
if @object_type='22' and (@transaction_type='A' or @transaction_type='U')
begin
if exists(select T0.docentry from opor T0 inner join NNM1 T1 on T0.series=T1.series where (T1.seriesname like 'Ord%') and (T0.U_Stage<>'Order') and T0.docentry=@list_of_cols_val_tab_del)
begin
select @error=1, @error_message='Series name and category should be both order'
end
end
Yogesh Jadav

Similar Messages

  • Oracle Java Store Procedure and JNI

    Hi ! 'Is the anybody out there ?'
    We don't know. We are developing a java store procedure in Oracle 9i. We need to use a propetary .so file about cript/decript information (entrust file). So have to use in oracle a .jar file with all software infrastructure that use this .so file. But, we have a problem. 'Cause, in windows, we can use a .dll file from our java store procedure, but when we run under unix aix, we have problem about jni.
    java.library.path in oracle console is empty.
    So we cannot find our share object... have you got an idea ?
    thanks!!
    andrea

    Oracle lite does not support the use of PL/SQL procedures or triggers in the database, so unfortunately you just cannot use them.
    as an alternative you need to either
    a) include the setting on the client records when they are created
    b) use before insert/update triggers on the main oracle database to populate the columns. NOTE if doing this you will find that the user that is actually responsible for the inserts and updates to the main database is MOBILEADMIN (as it is running the apply process. If you just want to log the fact that it was client created fine, but will not tell you the creating user)
    c) you should be able to use pure java stored procedures on the client (if in the main oracle database, they should replicate across, but beware of jvm differences and any advanced stuff that may not be supported. you will also have to get any necessary jar files over to the client as well)
    We have used method a) as a standard method called for all inserts/updates in the java client APPLICATION software based on the existance of the audit columns, rather than within the database as it is simpler

  • Front-End Service Starup Error: Store procedure to GET progress vector failed.

    Hi,
    We have a two front end servers in our Lync deployment and I'm getting an interesting error message on one of the servers when the "Lync Server Front-End Service" is starting up. All the services on that server will eventually start but I'm pretty
    sure it's affecting users in some way.
    Here is the error message in the Event Viewer:
    Log Name:      Lync Server
    Source:        LS User Services
    Date:          2013-09-17 8:00:32 AM
    Event ID:      32194
    Task Category: (1006)
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      BGC-VAN-LYNC2.domain.ca
    Description:
    Store procedure to GET progress vector failed.
    Execution Error: 0x00000000(ERROR_SUCCESS).
    Native Error: 8144.
    Error Details: [# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #].
    Cause: This may indicate a problem with connectivity to local database or some unknown product issue.
    Resolution:
    Ensure that connectivity to local database is proper. If the error persists, please contact product support with server traces.
    Event Xml:
    <Event xmlns=>
      <System>
        <Provider Name="LS User Services" />
        <EventID Qualifiers="50158">32194</EventID>
        <Level>2</Level>
        <Task>1006</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-09-17T15:00:32.000000000Z" />
        <EventRecordID>16971</EventRecordID>
        <Channel>Lync Server</Channel>
        <Computer>BGC-VAN-LYNC2.domain.ca</Computer>
        <Security />
      </System>
      <EventData>
        <Data>0x00000000(ERROR_SUCCESS)</Data>
        <Data>8144</Data>
        <Data>[# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #]</Data>
      </EventData>
    </Event>
    The error happens 15 times every minute, following with this event:
    Name:      Lync Server
    Source:        LS User Services
    Date:          2013-09-17 8:23:46 AM
    Event ID:      32189
    Task Category: (1006)
    Level:         Information
    Keywords:      Classic
    User:          N/A
    Description:
    The following Fabric service for routing groups have been closed:
    {F515134C-71B7-52FD-B0C3-6A9DB39CF750}
    {8A5D6B36-2A01-53DB-BC4E-3286C05E0836}
    {B35AAFC9-F6BF-5FFE-8C31-4AA5C36B2065}
    {69223418-78DC-5066-81A8-78E05914EC7B}
    {80414C96-1137-5DDC-8387-C3EA7A54B078}
    {641E6ABD-B862-55A1-B1B1-C83BC92D2F85}
    {1EA68EA4-77F7-5CFC-B781-0093CBC18403}
    {2FDE333D-FF7F-5D6A-B85B-93ADC1EAC12A}
    {A43BBA3A-8963-51C4-BD7A-19E1EC3DDFDB}
    {D3F4532F-61C8-5072-9B3B-3E2CCF15442F}
    {4449243E-5E96-56AC-AB6B-C5E785543542}
    {58B30261-65B6-5F6A-BC50-60F85782D052}
    {DB4B76B0-2510-5BF8-A7B1-8B37BD3AA7B9}
    {917CC217-966B-56AC-A912-97BA64BA13EB}
    Anyone knows what this is about and how to resolve this?
    Thanks,
    VH.

    Hi,
    Please try to reset registrar state:
    http://tsoorad.blogspot.in/2013/04/lync-2013-ee-pool-wont-start.html
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
    sure that you completely understand the risk before retrieving any suggestions from the above link.
    Kent Huang
    TechNet Community Support

  • Decrypt the encrypted store procedure through the T-SQL programming in SQL Server 2005

    HI ,
    I have a encrypted store procedure in my production server .Right now I do not have the script now I want do some modification.
    Please any one can help me to decrypt the store procedure it will be a great help for me.
    For any suggestion thanks
     in advance.
    " Education is the beginning of transformation. Dedicate yourself to daily learning via Blogs/Forums/books and coaching "
    Click here to read my blog

    I have modified Jon's post so it also supports functions correctly, jon's version gave a syntax error on functions because the dummy func sql was invalid
    1. Connect using "admin:server\instance"  instead of "server\instance" (enable dac if you havent already, its an sp_reconfigure command)
    2. create the below proc
    3. exec SqlDecryptor 'dbo', 'function_or_stored_proc_name'
    ALTER -- CREATE
    proc SqlDecryptor (@objschemaname nvarchar(255), @objname nvarchar(255))
    AS
    DECLARE @objid INT,@objtype NVARCHAR(50),@objtypicalstm NVARCHAR(4000),@objencrypted BIT
    SELECT TOP 1 @objid=o,@objname = n,@objtype = t,@objtypicalstm=s,@objencrypted = (SELECT ([encrypted]) FROM syscomments WHERE [id] = x.o and colid = 1)
    FROM
    SELECT object_id o, name n,
    CASE WHEN [type] = 'P' THEN N'PROCEDURE'
    WHEN [type] = 'V' THEN 'VIEW'
    WHEN [type] IN ('FN','TF','IF') THEN N'FUNCTION'
    ELSE [type]
    END t,
    CASE WHEN [type] = 'P' THEN N'WITH ENCRYPTION AS'
    WHEN [type] = 'V' THEN N'WITH ENCRYPTION AS SELECT 123 ABC'
    WHEN [type] IN ('FN','TF','IF') THEN N' () RETURNS INT WITH ENCRYPTION AS BEGIN RETURN 1 END'
    ELSE [type]
    END s
    FROM sys.all_objects WHERE [type] NOT IN ('S','U','PK','F','D','SQ','IT','X','PC','FS','AF')
    AND name = @objname AND (SCHEMA_NAME([schema_id]) = COALESCE(@objschemaname,'dbo'))
    --UNION ALL SELECT object_id,name,'TRIGGER',N'ON ALL SERVER WITH ENCRYPTION FOR DDL_LOGIN_EVENTS AS SELECT 1' FROM sys.server_triggers WHERE name = @objname
    --UNION ALL SELECT object_id,name,'TRIGGER',N'ON DATABASE WITH ENCRYPTION FOR CREATE_TABLE AS SELECT 1' FROM sys.triggers WHERE name = @objname
    ) x
    --SELECT @objid,@objname,@objtype,@objtypicalstm,@objencrypted
    SET NOCOUNT ON
    IF @objencrypted <> 0
    BEGIN
    IF EXISTS
    SELECT * FROM sys.dm_exec_connections ec JOIN sys.endpoints e
    on (ec.[endpoint_id]=e.[endpoint_id])
    WHERE e.[name]='Dedicated Admin Connection'
    AND ec.[session_id] = @@SPID
    BEGIN
    DECLARE @ChunkNumber INT,@ChunkPiece NVARCHAR(MAX),@CompareChunksAtPosition INT,@DummyChunk NVARCHAR(MAX),@DummyObject VARBINARY(MAX),@EncryptedChunk NVARCHAR(MAX),@EncryptedObject VARBINARY(MAX),@p INT,@p1 NVARCHAR(MAX),@p2 NVARCHAR(MAX),@QueryForDummyObject NVARCHAR(MAX),@ReplacementText NVARCHAR(4000)
    SELECT @EncryptedObject = [imageval] FROM [sys].[sysobjvalues] WHERE [objid] = @objid AND [valclass] = 1
    BEGIN TRANSACTION
    SET @p = 1
    SET @p1= N'ALTER'+SPACE(1)+@objtype+SPACE(1)+ISNULL((@objschemaname+'.'),'')+@objname +SPACE(1)+@objtypicalstm;
    SET @p1=@p1+REPLICATE('-',4000-LEN(@p1))
    SET @p2 = REPLICATE('-',8000)
    SET @QueryForDummyObject = N'EXEC(@p1'
    WHILE @p <=CEILING(DATALENGTH(@EncryptedObject) / 8000.0)
    BEGIN
    SET @QueryForDummyObject=@QueryForDummyObject+N'+@f'
    SET @p =@p +1
    END
    SET @QueryForDummyObject=@QueryForDummyObject+')'
    EXEC sp_executesql @QueryForDummyObject,N'@p1 NVARCHAR(4000),@f VARCHAR(8000)',@p1=@p1,@f=@p2
    SET @DummyObject=(SELECT [imageval] FROM [sys].[sysobjvalues] WHERE [objid] = @objid and [valclass] = 1)
    ROLLBACK TRANSACTION
    SET @ChunkNumber=1
    WHILE @ChunkNumber<=CEILING(DATALENGTH(@EncryptedObject) / 8000.0)
    BEGIN
    SELECT @EncryptedChunk = SUBSTRING(@EncryptedObject, (@ChunkNumber - 1) * 8000 + 1, 8000)
    SELECT @DummyChunk = SUBSTRING(@DummyObject, (@ChunkNumber - 1) * 8000 + 1, 8000)
    IF @ChunkNumber=1
    BEGIN
    SET @ReplacementText=N'CREATE'+SPACE(1)+@objtype+SPACE(1)+ISNULL((@objschemaname+'.'),'')+@objname +SPACE(1)+@objtypicalstm+REPLICATE('-',4000)
    END
    ELSE
    BEGIN
    SET @ReplacementText=REPLICATE('-', 4000)
    END
    SET @ChunkPiece = REPLICATE(N'A', (DATALENGTH(@EncryptedChunk) / 2))
    SET @CompareChunksAtPosition=1
    WHILE @CompareChunksAtPosition<=DATALENGTH(@EncryptedChunk)/2
    BEGIN
    SET @ChunkPiece = STUFF(@ChunkPiece, @CompareChunksAtPosition, 1, NCHAR(UNICODE(SUBSTRING(@EncryptedChunk, @CompareChunksAtPosition, 1)) ^ (UNICODE(SUBSTRING(@ReplacementText, @CompareChunksAtPosition, 1)) ^ UNICODE(SUBSTRING(@DummyChunk, @CompareChunksAtPosition, 1)))))
    SET @CompareChunksAtPosition=@CompareChunksAtPosition+1
    END
    PRINT @ChunkPiece
    SET @ChunkNumber=@ChunkNumber+1
    END
    END
    ELSE
    BEGIN
    PRINT 'Use a DAC Connection'
    END
    END
    ELSE
    BEGIN
    PRINT 'Object not encrypted or not found'
    END
    SET QUOTED_IDENTIFIER OFF
    GO

  • Can't execute Sybase store procedure

    Hi All,
    I'm trying to execute sybase store procedure, but somehow the procedure not executing. if any body what's the problem? I'm using JBoss server
    Code:
    public void deleteRigMapSP(String pMappingID, String rigid, String date,String pPhysicalDel, String database) throws DataAccessException {
    GregorianCalendar val = new GregorianCalendar();
    DateFormatter dateform = new DateFormatter();
    String deletiondate = dateform.convertGregorianToString(val);
    query = new StringBuffer("EXECUTE spRR_STAT_DeleteMapping ");
    query.append("'"+pMappingID + "',");
    query.append(null + ",");
    query.append(null + ",");
    query.append(null + ",");
    query.append(null + ",");
    query.append(null + ",");
    query.append(null + ",");
    query.append("'"+deletiondate + "',");
    query.append(pPhysicalDel);
    System.out.println("query: "+query);
    try {
         getDBConnection(ServiceLocator.getInstance().getDataSource(database));
         CallableStatement cs = dbConnection.prepareCall(query.toString());
    if (cs.execute()) {
              System.out.println("deleted");
         } else {
              System.out.println("not deleted");
    When I try to execute the method it's run fine, but it not executing the procedure.
    Any help will be greately appreciated.

    How do you know it's not executing? Maybe you're in manual transaction mode and you're not committing the transaction before you close the connection and it gets rolled back.
    And why on earth are you using CallableStatement if you're embedding the parameters into the SQL query rather than using placeholders and the setXXX() methods?
    Alin.

  • Compiling Store procedure

    Hallo together,
    i am using Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production and PL/SQL Release 11.1.0.6.0 - Production.
    I have a store procedure without bind variables, now I write this store procedure with bind variable.
    But i can not compile it with the orcale enterprise.
    I got following error message:
    Error
    Committing Failed: Missing IN or OUT parameter at index:: 1
    Can anyone help me?
    Best regards
    Andreas

    user8964782 wrote:
    sqlstr := 'SELECT * FROM table WHERE column = ' || key || ' ';
    cur := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(cur, sqlstr, DBMS_SQL.V7);
    DBMS_SQL.DEFINE_COLUMN(cur, 1, rID,18);
    sqlstr := 'SELECT * FROM table WHERE column = :bind_var ';
    cur := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(cur, sqlstr, DBMS_SQL.V7);
    DBMS_SQL.BIND_VARIABLE( cur, ':bind_var', key );
    DBMS_SQL.DEFINE_COLUMN(cur, 1, rID,18);My DBMS_SQL is a bit rusty - I try not to use it whenever possible due to its complexity. Ref cursors usually do the same thing with much less effort.
    The problem may be in the line
    sqlstr := 'SELECT * FROM table WHERE column = :bind_var '; Check the documentation and find out how DBMS_SQL expects you to populate ":bind_var" - you are doing this but there's something Oracle does not like; possibly you are doing itne DBMS_SQL.BIND_VARIABLE in the wrong place (does it go before the parse?). Also, find an example where this is done and look at it carefully.
    Good hunting!

  • Map Fields, store procedure results is "Expr1000"

    Hi guys.
    This is my problem.
    I have a sql server 2005 database. In this database i have a store procedure (3100 lines, with temporal tables, unions .. etc).
    When i try to create the report in CR9, i do this :
    1) i'm go to "set datasource location"
    2) select the database
    3) select the store procedure
    4) put some parameters
    5) Accept
    When i want to add the fields to the report ....
    the only results from the SP is a result field called "Expr1000".
    I execute the store in my sql server and this give me all the columns results (174 columns).
    My question is:
    What is the error , that in CR9 i can't see all the columns results , and only i can see "Expr1000".
    Thanks !!!!!
    Pablo Reynoso.

    This is definitely not the solution for everyone but reading this thread made me do a little more checking on my own.
    I too was receiving the "Expr1000" field from the SP when linking it into a new report or even when trying to MAP fields in an existing report template.  In the Map Fields dialog the source SP had no fields displayed for Mapping.
    What I discovered was S.U.E. (stupid user error).  While testing some changes to the source SP I changed the return result from returning data to returning the actual sql code I was constructing in the SP.  I often write the code into a local string variable and then use the 'exec(@str);' command as the final step of the SP.  I changed that code to 'Select @str;' which returned the @str string value when I executed the SP from within SQL Manager - to see the actual sql code.
    I never changed the code back to using the 'exec(@str);' so I was returning a 4,000+ char string from the SP which when loaded into Crystal the SP "field" became "Expr1000".
    After making this little change, returning the data instead of a single LARGE string the report behavior returned to what is was before the testing snafu.
    Hope this helps someone else, at least maybe point them to their code changes and not necessarily the CR template.
    Dave

  • Create directory issue in Store Procedure

    Hi Guys,
    can any one help?
    I am using XP, Oracle 10g, sql developer and Sql Plus.
    I am trying to create directory in storeprocedure, but it not let me to do that thing. below is the statement i am using
    create or replace directory public_access as '/tmp/public_access';
    please let me know hoe can i initialize my dir object in store procedure.
    Thanks

    user13012136 wrote:
    Hi Guys,
    can any one help?
    I am using XP, Oracle 10g, sql developer and Sql Plus.
    I am trying to create directory in storeprocedure, but it not let me to do that thing. below is the statement i am using
    create or replace directory public_access as '/tmp/public_access';
    please let me know hoe can i initialize my dir object in store procedure.
    ThanksTypically best NOT to do something like this in a procedure, but there are cases where it's needed.
    In those cases, you need to use Native Dynamic SQL.
    execute immediate 'create or replace directory public_access as ''/tmp/public_access''';  Assuming your syntax was correct before (i just copied and pasted what you had, adding quotes where needed).

  • Execute exp&imp command by store procedure

    Dear all,
    I have some statements to run before and after exp&impdata.
    Is there anyway to execute exp&imp command in store procedure,Pls show me.
    example
    CREATE OR REPLACE PROCEDURE test
    BEGIN
    update ....
    exp user/passwd ....
    delete ...
    END ;
    Oracle 10g on solaris10
    Thank you for advance
    Chara

    Hi,
    Since you are working with Oracle10gm you may check DBMS_DATAPUMP:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_datpmp.htm
    Or like any shell command, you can use java programs.
    Saad,
    http://saadnayef.blogspot.com

  • How to set store procedure parameters

    Hello,
    To summarize our problem, we are not able to set store procedure parameters using JRC and without using a Viewer.
    Inside an rpt document we use a call to a store procedure that requires some input parameters.
    We attempted to pass the required parameters to the report (please see below) but it seems that those parameters are somehow ignored.
    In fact null values are always received by the store procedure.
    For your information, if the document doesnu2019t contain a call to a store proc but SQL clause parameters instead, then that works.
    Does that mean that sp parameters have to be set in a specific way?
    Please can you advise?
    Tanks a lot,
    Joseph
    This is how we set parameter values:
    private void handleParameters(ReportClientDocument pm_document, List pm_parameters) throws Exception
         ParameterFieldController pfc = pm_document.getDataDefController().getParameterFieldController();
         pfc.setCurrentValue(reportName, parameterFieldName, parameterValue);
    Then we export in a pdf file:
    private InputStream createInputStream(ReportClientDocument pm_document, String pm_reportName) throws Exception
         return (ByteArrayInputStream)pm_document.getPrintOutputController().export(ReportExportFormat.PDF);

    First question:
    Do you set the parameters before the database logon?
    Sincerely,
    Ted Ueda

  • Using store procedures with SQLJ - please help!

    I have two questions:
    1.I wrote simple test appllication that uses SQLJ to run store
    procedures from SQL package. It compiles and work fine from
    JDeveloper 3 if I use java version JDK1.2.2_JDeveloper.
    It compiles OK in regular JDK1.2.2 but raise the following
    exception when running:
    profile
    com.itrade.trserver.truser.dbqueries.ItrHistorian_SJProfile0 not
    found: java.io.InvalidClassException: [Ljava.lang.Object;;
    Serializable is incompatible with Externalizable
    Does it mean that I have to use JDeveloper JDK?
    2.When I give other then default package for *.sqlj file the
    *.sqlj file is added to project but I cannot see it in specified
    package (the *.sqlj file is created in the its directory).
    After I compile the project the I can see *.java file in the
    specified package, but compiler gives errors about redefined
    symbols. If I remove *.sqlj file from the project it compiles OK.
    What I am doing wrong?
    Yakov Becker
    null                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thank you for the response.
    I don't create jar file. I run it from JDeveloper environment.
    What do you mean by "I made sure to also copy over the
    : the .ser file"? What purpose of the *.ser file in this case?
    Yakov
    JDeveloper Team (guest) wrote:
    : I have come across this error before..
    : I'm assuming that your jar file is in the classpath as
    : specified in the Jserv configuration?
    : When I had the error, I made sure to also copy over the
    : the .ser file.
    : In my case, I happened to have both my class files and
    : the .ser file outside of a jar file and it worked..
    : Hope this helps!
    : Yakov Becker (guest) wrote:
    : : I have two questions:
    : : 1.I wrote simple test appllication that uses SQLJ to run
    store
    : : procedures from SQL package. It compiles and work fine from
    : : JDeveloper 3 if I use java version JDK1.2.2_JDeveloper.
    : : It compiles OK in regular JDK1.2.2 but raise the following
    : : exception when running:
    : : profile
    : : com.itrade.trserver.truser.dbqueries.ItrHistorian_SJProfile0
    : not
    : : found: java.io.InvalidClassException: [Ljava.lang.Object;;
    : : Serializable is incompatible with Externalizable
    : : Does it mean that I have to use JDeveloper JDK?
    : : 2.When I give other then default package for *.sqlj file the
    : : *.sqlj file is added to project but I cannot see it in
    : specified
    : : package (the *.sqlj file is created in the its directory).
    : : After I compile the project the I can see *.java file in the
    : : specified package, but compiler gives errors about redefined
    : : symbols. If I remove *.sqlj file from the project it
    compiles
    : OK.
    : : What I am doing wrong?
    : : Yakov Becker
    null                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL Server Store Procedure, selecting rows from multiple tables

    i have got a store procedure that is pulling data from one table, now i have got the same data collected in a different table,
    as the IDs are different i cannot put all data from the second table into the first one. so now i have to have two select statements in one store procedure. Although the corresponding data is same but the field names in both table are different. for instance
    BRIEF_TITLE would be briefTitle in the second table. how can i merge the data from two different tables into one. the result is bonded to ASP.net grid view control.

    >> I have a store procedure that is pulling data from one table, now I have got the same data collected in a different table, as the IDs are different I cannot put all data from the second table into the first one. <<
    This is redundancy. The idea of databases even before RDBMS, was to remove redundancy. Oh, columns are not fields. These are basic concepts. 
    >> so now I have to have two select statements in one store procedure. Although the corresponding data is same but the field [sic] names in both table are different.<<
    NO! Where is your data dictionary that assures data elements have one and only one name everywhere in the enterprise!  You are is serious trouble here. The data element names should be universal and used everywhere with the same casing, so that case sensitive
    standards will work. 
    >> for instance BRIEF_TITLE would be briefTitle in the second table.<< 
    The quick kludge is a VIEW with the ISO-11179 names over the camelCase crap
    The moron who did the second table does not know ISO-11179 Standards and missed the research that showed us that camelCase does not work. Your eye is trained to jump to an Uppercase letter since it is the start of a semantic unit (proper name, sentence, paragraph,
    emphasis, etc). When we researched this stuff at AIRMICS, this could add 8-12% to the time to maintain code in large systems. Your eyes twitch! 
    You really need to get your act together with a good text editor/ pretty printer tools. Get a copy of my SQL Programming Style and adapt it to those tools. 
    >> The result is bonded to ASP.net grid view control. <<
    We are the SQL guys; we do not are about the presentation layers :) 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Store procedure help

    is it possible to write store procedure for inserting records and multiplying them
    description qt rate Amount
    drop procedure a1;
    create or replace procedure a1
    a_description in varchar2,
    a_qt in number,
    a_rate in number,
    a_amount in number)
    as
    begin
    insert into employee_record values (a_description,a_qt,a_rate,a_qt * a_rate);
    end;
    is it possible that column amount calculates the amount itself
    when i try to execute ( 'Hard Drive', 4, 100)
    it gives me an error message .
    wrong number or types of arguments in call to 'INSERT_a1'
    when i try to run it with ('Hard Drive',4,100, 5) it inserts values and also updates column with correct amount which is 400 .
    it would be kind of you if you could show me the a better way to write this store procedure or where i should makes changes.
    so that my amount column calculates the total itself
    thanks

    Hi,
    Someoneelse is right: storing columns that depend entirely on other columns is usually a bad idea. Compute the amount in queries, as needed, or create a view that computes amount.
    If you really must store it in the table, then you can use a trigger, like this:
    CREATE OR REPLACE TRIGGER employee_record_biu
    BEFORE INSERT OR UPDATE OF qt, rate, amount
                                 ON employee_record
    FOR EACH ROW
    BEGIN
        :NEW.amount := :NEW.qt * :NEW.rate;
    END;
    /This will automatically run whenever you issue an INSERT or UPDATE statement that references the columns involved. If that statement provides a value for amount, that value will be ignored. Amount will always be calculated from qt and rate.
    Starting in Oracel 11, you can create a virtual column, which will probably be better than a trigger.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_7002.htm#sthref7273

  • Execute store procedure from form

    How do I execute a store procedure from FORM
    I have a store procedure in the database
    all it does insert a value to table test.
    in 'WHEN-NEW-INSTANT-TRIGGER' of the form MODLUE I put
    test_curor; (name of the store procedure)
    The module does have block or any thing it.
    There was no syntax errors or form error
    but it did not insert into the table.
    Why????

    I just tested this myself and you are right. If you have one block with no items in it the when-new-form-instance trigger will not be fired. I got a message back saying 'block had no items', though it ran OK. This kinda makes logical sense, since there is nothing for the form to do. I put a button onto the block and the procedure fired no problem. I must admit I have never tried creating a form with no items in it so I haven't seen this behaviour before.
    Shucks you live and learn every day!

  • Store Procedure required to check Quantity total

    Dear Experts,
    Kindly help me in writing Store Procedure, my requirement is to have an validation on Inventory Transfer Form where i have created two udf fields in row level as A & B contains where user enter value which is calculated as A * B  that is equal to  total Quantity,  for ex. (A * B = Quantity).
    So i need here a validation check before adding this document, that Field A value multiply by Field  B value that should to be total Quantity in case changes made in field A or Field B but not update before saving this document it would result be wrong Quantity total.
    To avoid such user entering mistakes a SP is required to check whether the Quantity total is equal to Field A value * Field B value.
    Thanking in Advance....
    Regards,
    Krishnakumar

    Hi!  Gordon,
    Already there is an FMS to Calculate Field A value * Field B value and it through it's result to the Field Quantity. Now am looking to have an validation check or control that should actually check before document get saved that the value entered in Field value A multiply by Field value B  is that get tallied with the Field Quantity.
    For ex: Field A value contain figure 100 and Field  B value contain figure 200 then the Field A * Field B = Quantity i.e. (100 * 200 = 20,000). In case if the user change the field Value of A or B without updating the Field Quantity then it result in correct Quantity.
    So I need a Store Procedure that check the field value of A & B and check the product sum Field value Quantity if it matches then it should allow to save the document other wise it should print a Error message "Calculation Error".
    I hope you understand what am exactly required, so i need  your helping hands to get this Store Procedure.
    Thanks in Advance,
    Regards,
    Krishna
    Edited by: krishnaoctopus on Jun 14, 2011 2:49 PM

Maybe you are looking for