SQL Query to update UDF

Hi all
Can anyone please assist me here , on my db i have
three UDF's linked to one table.
These UDF's are for routes - when you select the route code the query must update the route name and the driver name .
This info is all in one UDT.
Thanks

Hello Bongani,
SELECT
   T0.U_DriverName
FROM
   .[@Routes] T0
WHERE
   T0.Code=$[TABLE.FIELD]
/code
I assume you have the Routes UDT set like this:
Code | Name | DriverName | ...
Just change TABLE and FIELD with the name of the table and field you're importing the value to.
Best Regards,
Vítor

Similar Messages

  • Sql query to update record?

    hi1
    i have 1000 rows in my table that are not unique. i have added a new column named sno.initially that contains null values. Now i want to update the table with sno contains serial no. from 1 to 1000 in a single SQL query
    please help
    Thanks
    Harinder

    hi1
    i have 1000 rows in my table that are not unique. i
    have added a new column named sno.initially that
    contains null values. Now i want to update the table
    with sno contains serial no. from 1 to 1000 in a
    single SQL query
    please help
    Thanks
    HarinderIt will work..
    Update <table_name> set <column_name> = ROWNUM
    whether the records are duplicate or not...

  • Form on SQL query for updating.

    Hello again,
    Im trying to wirte a form to udapte the information in a table. I have a table with a PK which holds a persons name, and an activity assigned to them (and loads of other fields but they dont matter atm). I would like to have a form which has an SQL query running in one region and then the form underneath to be able to edit (reassign a person to a different activity) an item appearing in the query result. Ive got a form at the moment which is form on an sql query but its not updating when i fill out the form, is it something to do with the regions?
    http://img.photobucket.com/albums/v611/Funky_Monk/untitled.jpg
    So on the screenie, i have the bottom region for the query (no values in table hence the error (i think!))
    The call ID is FK to another table
    severity level and status will be usdated here
    description is self-explanitory
    analyst_id is the main field to be changed here, the call id will be assigned a new analyst via this form.
    action_id is actions carried out on this problem.
    Any help would be greatly appreciated.
    DM

    hi,
    Can you put this example on apex.oracle.com?
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • [Solved partially] Sql query for updates compliance

    Hello
    I'm trying (with no success) to translate the "Software+Updates+-+A+Compliance%2fCompliance+1+-+Overall+compliance" report into a sql query that must run for a specific
    Software update group and for a specific Collection ID.
    The expected result should be like the report it self, I mean 3 lines with Kpi (pourcentage).
    The main query in this report is : 
    select
    CollectionID=@CollID,
    Status=sn.StateName,
    cs.NumberOfComputers,
    PComputers=convert(float, isnull(cs.NumberOfComputers, 0)*100.00) / isnull(nullif(cs.NumTotal, 0), 1),
    AuthListID=@AuthListID
    from (select CI_ID, NumTotal, [0]=NumUnknown, [1]=NumPresent+NumNotApplicable, [2]=NumMissing
    from fn_rbac_UpdateSummaryPerCollection(@UserSIDs)
    where CI_ID=@CI_ID and CollectionID=@CollID
    ) cnt
    unpivot (NumberOfComputers for [Status] in ([0], [1], [2])) cs
    left join fn_rbac_StateNames(@UserSIDs) sn on sn.TopicType=300 and sn.StateID=cs.Status
    where cs.NumberOfComputers>0
    order by cs.NumberOfComputers desc
    I have no clue on how to replace or use fr_rbac view when run outside a report.
    Can you please help me ?
    Thanks

    Hi,
    Glad to hear that and thank you for your sharing.
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • SQL Query to update Item OnHand in SAP B1 2005

    hi all,
                  is it possible to write a Update query in sql to modify item OnHand ? is it possible to do that in SAP B1 for UDF?
         i want to create a UDF and the enter value in it should be deducted from the Item OnHand Stock. is there any query is possible to modify the item on hand.
    if it is possible then kindly send me the query.
    sandip

    hey sandip if u are updatin ur own fields then it is allowed. But if it a field in the sap tables then NO way.. U gotta use the DI API to update these fields.. I u want to reduce the stock the n use the Goods Issue DIAPI.. I tink its The INVGenEXit DiAPI.. Remember if u using the DiApI u Allowed to do only wat u can in the front end
    Regards
    Aris

  • SQL Query to update Item OnHand in SAP B1

    hi all,
                  is it possible to write a Update query in sql to modify item OnHand ? is it possible to do that in SAP B1 for UDF?
         i want to create a UDF and the enter value in it should be deducted from the Item OnHand Stock. is there any query is possible to modify the item on hand.
    if it is possible then kindly send me the query.
    sandip

    Hi Sandip,
    Modifying the OnHand quantity for an item directly through SQL is forbidden by SAP. Updating a UDF is also not recommended. The recommended method for updating a UDF is through the SDK.
    I'm not sure what you are trying to achieve. If you wish to change the stock quantity for an item then you need to add the most appropriate transaction, either through the UI or via the SDK (eg Goods Issue, Goods Receipt, AR Delivery etc).
    Kind Regards,
    Owen

  • Enhance a SQL query with update of millions of rows

    Hi ,
    I have this query developed to updated around 200 million of rows on my production , I did my best but please need your recommendations\concerns to make it more enhanced
    DECLARE @ORIGINAL_ID AS BIGINT
    SELECT FID001 INTO #Temp001_
    FROM INBA004 WHERE RS_DATE>='1999-01-01'
    AND RS_DATE<'2014-01-01' AND CLR_f1st='SSLM'
    and FID001 >=12345671
    WHILE (SELECT COUNT(*) FROM #Temp001_ ) <>0
    BEGIN
    SELECT TOP 1 @ORIGINAL_ID=FID001 FROM #Temp001_ ORDER BY FID001
    PRINT CAST (@ORIGINAL_ID AS VARCHAR(100))+' STARTED'
    SELECT DISTINCT FID001
    INTO #OUT_FID001
    FROM OUTTR009 WHERE TRANSACTION_ID IN (SELECT TRANSACTION_ID FROM
    INTR00100 WHERE FID001 = @ORIGINAL_ID)
    UPDATE A SET RCV_Date=B.TIME_STAMP
    FROM OUTTR009 A INNER JOIN INTR00100 B
    ON A.TRANSACTION_ID=B.TRANSACTION_ID
    WHERE A.FID001 IN (SELECT FID001 FROM #OUT_FID001)
    AND B.FID001=@ORIGINAL_ID
    UPDATE A SET Sending_Date=B.TIME_STAMP
    FROM INTR00100 A INNER JOIN OUTTR009 B
    ON A.TRANSACTION_ID=B.TRANSACTION_ID
    WHERE A.FID001=@ORIGINAL_ID
    AND B.FID001 IN (SELECT FID001 FROM #OUT_FID001)
    DELETE FROM #Temp001_ WHERE FID001=@ORIGINAL_ID
    DROP TABLE #OUT_FID001
    PRINT CAST (@ORIGINAL_ID AS VARCHAR(100))+' FINISHED'
    END

    DECLARE @x INT
    SET @x = 1
    WHILE @x < 44,000,000  -- Set appropriately
    BEGIN
        UPDATE Table SET a = c+d where ID BETWEEN @x AND @x + 10000
        SET @x = @x + 10000
    END
    Make sure that ID column has a CI on.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL Query for update

    hi experts
    I got two tables
    BOOK (DDC,TITLE,ISBN,AUTH_NAME)
    AUTHOR (ID,DDC,AUTH_NAME)
    AUTH_NAME column in BOOK's table contains NULL for all records.
    I want update table BOOK's column AUTH_NAME from AUTHOR's column in AUTHOR table where DDC numbers match. DDC is not unique in AUTHOR's table. I want to update BOOK table with the first matching AUTH_NAME. Rest should be ignored.
    Please write me the query for it.
    thanks

    Please write me the query for it.This fellow has no questions.
    Please, DO NOT ANNOY HIM with hints and tips, he just wants his answer. ; )
    I suspect it's homework, just another cheating student, earning his OCP.
    He is very anxious to get somebody to do his work, as he has spammed this same questtion on several other Oracle forums:
    http://dba.ipbhost.com/index.php?showtopic=10441
    http://www.dba-village.com/village/dvp_forum.OpenThread?ThreadIdA=32264

  • SQL query for updating values in same cell of a table

    Hi All,
    I'm stuck with a problem and it stands as follows:
    Table name: Track
    Part1  Part2  Part3
    NULL   NULL   NULL
    I've a table called Track, which has three columns named Part1, Part2 and Part3. I want all values of Part1 to be separated by a comma (,); it should not be overwritten, neither they should appear in separate row, in fact they should look like this:
    Part1    Part2    Part3
    1,2,3    5          SUBM1
    The new values of Part1 should appear in next row only when value of Part3 changes, so if Part3 changes from SUBM1 to SUBM2, it should look like this:
    Part1    Part2    Part3
    1,2,3    5          SUBM1
    1,2,3    5          SUBM2
    Count of values in Part1 never exceeds the value of Part2, so if Part2 is 5, then Part1 will look like 1,2,3,4,5. So in other words loop will run only up to the value of Part2.
    Please advise how this could be achieved?
    Kind regards,
    Aniruddha Jagdale

    I've a table called Track, which has three columns named Part1, Part2 and Part3. I want all values of Part1 to be separated by a comma (,);
    No, don't go there.
    This breaks a fundamental point for relational databases: no repeating groups. A cell should hold an atomic value. And this is not only a matter of purism. Relational databases are designed from this principle, and breaking this means that you will need
    to write complex and higly inefficient code.
    The values in Part1 should be in a separate table, with one value per row.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • SQL Query Posting the Data Properly but Generating An Error

    I've created a SQL query to update records in a database.  While testing I used an Access database and it worked perfectly.  To go into production I've moved the data to SQLServer 2005 installed on my xMII server.  The SQL syntax is different for handling dates between the two databases so I modified my queries accordingly.  I now have:
    UPDATE ControlLimits SET Metric_ID='[Param.1]', CDate='[Param.2]', LCL=[Param.3], Mean=[Param.4], UCL=[Param.5]
    Where  (Metric_ID='[Param.1]' and CDate = '[Param.2]')
    CDate is my date field being passed in the format 'mm/dd/yyyy', the table field is formatted for datetime - the same as in Access.
    When running this query (with the [Param.x]'s being replaced with actual values)through SQL Server Management Studio on the xMII server, it works just fine.  When run as a query template, the data is posted properly to the table but the template returns a 'A SQL Error has occurred on query, The statement did not return a result set..' 
    Any ideas?
    David

    Udayan,
    You are absolutely correct!  When I did it in Access I was correctly using the Command mode.  When I moved to the SQL Server data source in my query template, I picked the Fixed Query mode by mistake.
    Thanks for your help!
    Regards,
    David

  • Memory leak/overload when looping by index over a large query and updating each DB record

    I am importing a CSV file into a temporary table and then running a select query that joins my actual database table with the temporary table, looking for any changes in the data. If changes exist, the select query is looped from 1 to #recordCount# and an update is applied to each record via cfquery. It runs very quickly (much more quickly than looping the query itself), but my memory spikes and overloads after about 1500 updates are completed. I need to be able to do upwards of 20000 at a time, without killing my system. I have tried manually setting the runtime garbage collection to trigger after X number of loops, but that doesn't seem to help. I am running CF8. See below for loop example:
    <cfloop from="1" to="#updatedRecordsQuery.recordCount#" index="a">
    <cftry>
                    <cfquery datasource="#db#" name="doUpdate">
                        UPDATE
                            CI
                        SET
                            firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.firstname[a]#" />,
                            lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.lastname[a]#" />,
                            etc, for about 15 various fields
                        FROM
                            client_info CI
                        WHERE
                            CI.client_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#updatedRecordsQuery.client_id[a]#" />
                    </cfquery>
                    <cfcatch type="database">
                        <cfset local.updateErrorList = listappend(local.updateErrorList,updatedRecordsQuery.client_id[a]) />
                        <cfset local.error = true />
                    </cfcatch>
               </cftry>
    </cfloop>

    I would suggest to use select update instead of looping over query object and update each row one-by-one.
    Procedure:
    - Insert your CSV data into temp table.
    - Use a select update SQL query to update the changed data instead of looping over a select query.
    Example:
    UPDATE
       Table
    SET
       Table.col1 = other_table.col1,
       Table.col2 = other_table.col2
    FROM
       Table
    INNER JOIN
      other_table
    ON
       Table.id = other_table.id
    NOTE: You can put all your scripts in a Procedure.

  • Adding update and delete buttons to a  Report from SQL Query

    There is an option when creating a QBE to add update and delete
    links which i find quite useful, but this option doesn't seem to
    be possible on a Report from SQL Query. Do i need to do
    something special to add them? is the option located in a
    different place?

    Hi,
    You can only add Update ,Delete in QBE Reports,
    there is no option in Portal which can be used to
    have these buttons in the Reports from Query Wizard or
    Report from SQL Query.
    Thanks
    Vineet

  • How to update two different tables by ony one sql query???

    Hi All,
    i need to update two different talbes in a single sql query..
    i m using the following query
    UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12
    AND
    UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
    i m getting the following error:
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12 . [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL writeback UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
    but when i m ushin the same query in Microsoft SQL Server it executes properly:
    please help me out...

    There's no valid syntax for this, but there are some tricks you could do to achieve it.
    i) You could place an update trigger on TABLE1 to update TABLE2 automatically.
    ii) You could define a view across both tables and add an INSTEAD OF UPDATE trigger to it to maintain them.
    If I had to do this I'd choose option2, but frankly I'd just be running two updates if it really was me.

  • Update Field On Change For A SQL Query (updateable report)

    Hi,
    I'd like to request help from anyone with ideas on how to solve this.
    We are using APEX 4.2, 10GR2, RedHat5.
    I have a report that comes from SQL Query (updateable report).
    I'm using the apex_item.text and apex_item.hidden on fields.
    I'm using a button to submit and after submit process to add some logic that I need.
    There could be 1 - 10 records in the report.
    There is only 1 field that is needed to enter a value, but the value of this field determines the value of another field.
    I think that I can do this with a submit button and an after submit process where I loop through all the records. I think I have this handled.
    This is the question
    When the value of that field is changed then the value of another field in the same row changes immediately.
    Is this possible?
    All the examples I've seen so far are for a single record and that doesn't work for us.
    I guess this is a MRU process but I haven't seen an example where a dynamic action is possible on a Multi Row Update.
    Could anyone direct me to where I can see an example or help me get directions?
    I appreciate all your help an comments and I thank you in advance.

    Yes why not...what you looking for is a ajax call
    See {message:id=10390979}
    Please note:-you can also do this as a dynamic action as shown below
    Event: Change
    Selection type: jQuery Selector
    jQuery Selector: input[name="f01"]
    True action with Execute JavaScript Code and put all code inside the test funtion, you may need to amend the code to use this.triggeringElemnt in place of this

  • Need help in SQL Query: Update a row in a table & insert the same row into another table

    I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
    Thanks in Advance.

    Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
    SQL> var v_id number
    update tableA  
    set colB='ABC' 
    where colC='XYZ' 
    returning id into :v_id;
    insert into table A_History (ID, colA, colB, ColC)  
    select id, ColA, ColB, ColC  
    from tableA  
    where id = :v_id;   

Maybe you are looking for

  • Video ipod froze

    I purchased a movie from those online "movies to ipod" sites (buyimovies.com) and put it on my 80g video ipod. the movie worked fine as i would watch about a half hour each night before bed. one night, the screen went dark and the ipod froze. i tried

  • 1st of the Quarter for yesterday.....

    Morning everyone, I need to write a bit of code that will retrieve the first day of the quarter, based upon yesterday's date (ie 1st of the Q for yesterday would be 01/04/2007). I have managed to achieve this using the following code: select case to_

  • SYNTAX ERROR IN SAPMSSYD PROGRAM

    HI ,            We included the code in Program 'SAPMSSYD' for our internal validation. This validation requires to fetch the data from the ztables. we created ZTABLE and included custom code in SAPMSSYD in DEV server and tested sucessfully. We tried

  • Couldn't open my microsoft word attachment.

    New to a mac. Just got one on the new release of OSX. I mailed myself a word attachment from a PC and when I got it on my Mac, it didn't recognize it as a word document. Microsoft Office 2004 is installed. I tried to do a "open with" and clicked WORD

  • W701ds doesn't start

    A tricky case: I've just replaced the main screen from the W701ds, and when I try to start the laptop, it doesn't start. Just the led power light for two seconds but it doesn't go into the BIOS and dies. The screen always in black. If I try to restar