Take the substring of the value returned by REGEXP_SUBSTR

I haven't used regular expressions really before and tried to do some reading on how it works.

Im trying to parse a string to pull a specific value.

Using an example, I found from Oracle, I could find something that is very close to what I want to do, but it includes the delimiter character, and I can't seem to find a way to get rid of it.

For example

SELECT REGEXP_SUBSTR ('COUNT: 88, NUMBER: 12345678, LICENSE: 123456789', ': [^,] +', 1.1) RESULT
FROM DUAL;

The result: 88

It changes a little

SELECT REGEXP_SUBSTR ('COUNT: 88, NUMBER: 12345678, LICENSE: 123456789', ': [^,] +', 1.2) RESULT
FROM DUAL;

I got a return of: 12345678

Which is basically what I want, I want to be able to extract the values between the ': 'and the','

The values can vary in length, so I spread using the substr function.

If anyone knows how I can get just the digital output without the extra ':' face?

Very much appreciated...

Why not use substr with regexp_substr:

SELECT SUBSTR (REGEXP_SUBSTR ("COUNT: 88, NUMBER: 12345678, LICENSE: 123456789', ' LICENSE: [^,] +'1, 1"), 9) RESULT
FROM DUAL;

Result:
123456789

I recommend that you do not simply include him ': ' but also the whole, Word such as "LICENSE:

Tags: Database

Similar Questions

  • I would like to summarize the values returned by a formula similar to the 'search', but for ranges or entire columns

    Thus,.

    I have three values in column K - 'A', 'B', 'C '. Column I is numeric values.

    I am trying to create a formula that selects all rows in the K column with a specfic value (in this case 'A' 'B' or 'C'), then grab the corresponding value (on the same line) of column I, then add up all the results for a total.

    IF rows in column K returns 'A', THEN take the VALUE of corresponding column I, and THEN SUM all the values returned.

    Or something like that.

    You can try something like this:

    The formula in B2, filled to the bottom, is:

    SUMIF (table 1::K, A2, table 1::L)

    SG

  • JavaScript input parameter should take the value of the element page Apex

    I have a JavaScript function which i dwonloaded ffrom net to generate bar codes

    DrawCode39Barcode(data,checkDigit).

    I call this function in the body of page attribute by using the following script

    < div id = "P5_X" > < / div >

    < script type = "text/javascript" >

    / * < ! [CDATA [* /]]

    function get_object (id) {}

    var object = null;

    If (document.layers) {}

    object = document.layers [id];

    } Else if (document.all) {}

    object = document.all [id];

    } else if (document.getElementById) {}

    object = document.getElementById (id);

    }

    Returns the object;

    }

    get_object('P5_X').innerHTML = DrawCode39Barcode('1-1-1111',0);

    < /script >

    When I run the page, the barcode for the value 1-1-1111' is generated. Please help so that when this page is running it will automatically take the value of the page item P5_X as parameter instead of hard coded value ' 1 - 1-1111'

    I think it would be simpler. You use the same id for the region and the order of the day, they must be different id

    JavaScript code can be in a dynamic action who sets fire to the loading of the page, or load Execute on the page of your page properties section.

    $('#barcode').html (DrawCode39Barcode ($v ('P5_X'), 0));

  • How to navigate to the next page based on the value returned by the method call inside the action attribute of the command key.

    How to navigate to the next page based on the value returned by the method call inside the action attribute of the command key.

    I use JDeveloper 12.1.2.0.0

    < af:button id = "tt_b2".

    rendered = "#{attrs.nextRendered} '"

    partialSubmit = 'true '.

    action = "#{attrs.backingBean.nextAction} '"

    Text = "next".

    Disabled = "#{attrs.nextDisabled}" / >

    private static final String NEXT_NAVIGATION_ACTION = "controllerContext.currentViewPort.taskFlowContext.trainModel.getNext";

    public String nextAction() {}

    If (validate()) {}

    updateModel();

    Return NEXT_NAVIGATION_ACTION;

    }

    Returns a null value.

    }

    Use case is made for model train, which is being implemented based on this blog: http://javacollectibles.blogspot.co.UK/2014/10/ADF-train-template.html

    We define a generic action following in the model, but the action must be called under certain conditions, based on the question of whether all validation controls had been passed on no.

    You can do this in two ways:

    1 returnValue = (String) ADFUtils.invokeEL("#{controllerContext.currentViewPort.taskFlowContext.trainModel.getNext}");

    return returnValue;

    2.

    public String getNextTrainStop() {}

    String nextStopAction = null;

    ControllerContext controllerContext = ControllerContext.getInstance ();

    ViewPortContext currentViewPortCtx = controllerContext.getCurrentViewPort ();

    TaskFlowContext taskFlowCtx = currentViewPortCtx.getTaskFlowContext ();

    TaskFlowTrainModel taskFlowTrainModel = taskFlowCtx.getTaskFlowTrainModel ();

    TaskFlowTrainStopModel currentStop = taskFlowTrainModel.getCurrentStop ();

    Terminus of TaskFlowTrainStopModel = taskFlowTrainModel.getNextStop (currentStop);

    nextStopAction = nextStop.getOutcome ();

    _logger.fine ("train, next stop:"+ nextStopAction ");

    Return nextStopAction;

    }

  • The value returned by the function to load is not of type digital errors after migration to Coldfusion 11

    I'm currently testing our website with CF11. He is currently working with CF8 however after the migration to a new server running CF11 I met the following error.

    The value returned by the function of load is not numeric.

    The error occurred in

    D:/applications/CFusion/CustomTags/NEC/COM/objects/address.cfc: line 263
    Called from D:/apps/CFusion/CustomTags/NEC/com/objects/contact. CFC: line 331

    Called from D:/applications/CFusion/CustomTags/NEC/COM/objects/user.cfc: line 510

    Called from D:/applications/CFusion/CustomTags/NEC/COM/objects/user.cfc: line 1675

    Called from D:/website/NECPhase2/action. Validate.cfm: line 54

    261: < cfif isNumeric (get.idCountry) >

    262: < cfset rc = this.objCountry.setID (get.idCountry) >

    263: < cfset rc = this.objCountry.load () >

    264: < / cfif >

    265: < cfset this.sPostcode = get.sPostcode >

    Were there any changes between CF8 and CF11 which can cause this error?

    Does anyone have any ideas?

    The problem is in the charge function.  There is a real return at the end of the function.  The returntype of the function is set to digital.  True is not digital, it will trigger an error.

  • How to locate the values returned by the data adapter

    I have a need to internationalise/locate a string which our data adapter returns to the web client to fill out things like the table of inventory for our type of object.

    In other words, I would need to make the location in my Java code on the service side.

    But what I do not know how to do is how do I know what locale, the answer must be returned for.  I don't get the locale information in the query for the data.

    Looks like I found my answer: I can get information from the UserSession returned by the UserSessionService.

    One thing I discovered, is that the user must connect to the web client with the regional settings in place.  If you change the value of & local once the user is connected, the new value takes effect.  You will need to sign out and then sign back in.

  • The value returned by the function is not of type query

    I couldn't understand why I got this error.  I put the default var query.  Help, please.  If qLocal files then fine back, but when the archives qLocal is empty throw errors.  I set a default value.

    < name cffunction = "getName" access = "public" returnType = out of the "query" = "false".
    Hint = "this method returns a query." >
    < cfargument name = "id_fk" required = "no" default = "0" >
    < cfargument name = "id2_fk" required = "no" default = "0" >

    < cfset var qQuery = "" > "".

    < name cfquery = "qLocal" datasource = "#db #" >
    SELECT *.
    FROM tbl
    WHERE id = < cfqueryPARAM value = "#id_fk #" CFSQLType = "CF_SQL_INTEGER" > AND id2 = < cfqueryPARAM value = "#id_fk2 #" CFSQLType = "CF_SQL_INTEGER" >
    < / cfquery >


    < cfif qLocal.recordcount >
    < cfquery name = "qQuery" datasource = "db" >

    SELECT *.

    FOR tbl2

    WHERE tbl2id = < cfqueryPARAM value = "#qLocal.id #" CFSQLType = "CF_SQL_INTEGER" >

    < / cfquery >

    < / cfif >

    < cfreturn qQuery >
    < / cffunction >

    The query named qQuery only runs if the qLocal returned entries. You initialized qQuery as a variable, which is not a query object. If you initialize qQuery as a query object using the QueryNew (columnlist) that should work.

  • Take the values of this same line of a column max

    Hello

    I did a group by in a query to date max of straight, but I need to take on values of that same line with this maximum value.

    Max (to_date(fec_ini_vigencia_costo,'DD/mm/YYYY')) is the line I want to take

    and

    -max (mto_precio_venta_cm_iva),
    -fec_fin_vigencia_costo,
    -l.CND_TRASPASADO_PRECIO

    the values I want to take advantage of this line

    select p.item_orms, 
           item_ebs, 
           description, 
           zone_id, 
           max(to_date(fec_ini_vigencia_costo,'DD/MM/YYYY')) as fecha_inicio,
           -- max(mto_precio_venta_cm_iva),
           -- fec_fin_vigencia_costo,
           -- l.CND_TRASPASADO_PRECIO
    from precios9 p,
         cmp_lineas_cotizacion_suc l,
         LCM.CMP_ENCABEZADO_COTIZACION d 
    where p.zone_id = 1
         and l.cod_producto = p.item_ebsi'
         and d.NUM_COTIZACION_ORCL = l.NUM_COTIZACION_ORCL
         and l.cod_sucursal in (125,89,90,92,95,97,99,101,104,106,108,110,112,115,83,85,
                               87,88,91,93,94,96,98,100,102,103,107,109,111,113,114,116,
                               117,120,123,124,128,130,132,134,135,133,131,129,118,182)
    group by p.item_orms, item_ebs, description, zone_id

    Buon Giornio!

    Here are two ways to do it. First of all, using analytical functions and then with a subquery.

    I took your sample data and converted into a WITH statement, so I could test my queries. The SQL code that you need to write is near the bottom.

    WITH dta AS (
    SELECT 100124238 AS ITEM_ORMS,1.1073131 AS ITEM_EBS,'Comino Badia Molido 28Gr' AS DESCRIPTION,1 AS ZONE_ID,TO_DATE('03/02/2007','dd/mm/yyyy') AS FEC_INI_VIGENCIA_COSTO,1.7 AS MTO_PRECIO_VENTA_CM_IVA,TO_DATE('08/12/2010','dd/mm/yyyy') AS FEC_FIN_VIGENCIA_COSTO,'Si' AS CND_TRASPASADO_PRECIO FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('09/06/2008','dd/mm/yyyy'),24.9,TO_DATE('13/04/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/04/2009','dd/mm/yyyy'),31.95,TO_DATE('01/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('01/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('11/06/2009','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('11/06/2009','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'Si' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL UNION ALL
    SELECT 100132641,1.1054401,'Crema Meggle Chantilly Natural 250Gr',1,TO_DATE('13/05/2010','dd/mm/yyyy'),62,TO_DATE('13/05/2010','dd/mm/yyyy'),'No' FROM DUAL
    )
    SELECT DISTINCT
       MAX ( FEC_FIN_VIGENCIA_COSTO ) OVER () FEC_FIN_VIGENCIA_COSTO
      , FIRST_VALUE ( MTO_PRECIO_VENTA_CM_IVA ) OVER ( ORDER BY FEC_FIN_VIGENCIA_COSTO DESC  ) AS MTO_PRECIO_VENTA_CM_IVA
      , FIRST_VALUE (  CND_TRASPASADO_PRECIO  ) OVER ( ORDER BY FEC_FIN_VIGENCIA_COSTO DESC  ) AS FEC_FIN_VIGENCIA_COSTO
    FROM dta
    ;
    
    FEC_FIN_V MTO_PRECIO_VENTA_CM_IVA FE
    --------- ----------------------- --
    08-DEC-10                     1.7 Si
    
    1 row selected.
    

    And here's the subquery

      << omitted the WITH clause here, just to save space >>
    
    SELECT
      MTO_PRECIO_VENTA_CM_IVA
      , FEC_FIN_VIGENCIA_COSTO
      , CND_TRASPASADO_PRECIO
    FROM dta
      WHERE FEC_FIN_VIGENCIA_COSTO = ( SELECT  MAX(  FEC_FIN_VIGENCIA_COSTO )  FROM dta )
    ;
    
      MTO_PRECIO_VENTA_CM_IVA FEC_FIN_V CN
      ----------------------- --------- --
                          1.7 08-DEC-10 Si
    
    1 row selected.
    

    I would caution you to be careful with either technique: you have not specified a deterministic sort. There are a lot of records with the same values in this field. If if were not for the record for December 8, 2010, the highest value would be on May 13, 2010, and there are 22 records with that value. This means that Oracle would have to break the tie.

  • How to change the value returned with. by SQL / PL/SQL function

    I found on the community service of coracle that rounds and add the zeros to the right if necessary to dynamically add zeros to the right but the result is returned in constains format. Te 999.99 but I need to get 999.99, how do I solve this problem

    Modify the function to replace the. characters in, character.  Look at the function of string to replace oracle: REPLACE

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Anomaly when CF takes the value 2 and &amp; quot; 01/01/1900 &amp; quot;

    OK, that's an odd. In a piece of code, I have had an assessment like this
    < cfif 2 IS "01/01/1900" > false < cfelse > True < / cfif >

    And for some reason any "2 on 1 JANUARY 1900" "" the true resolution! Why is this? Anyone has any idea why?

    Thank you
    Marvin

    If you try you will notice that it generates on 01/01/1900. When you tried to compare a date string, CF 01/01/1900 acknowledged a date and tried to force 2 at a date as well.

    Im not sure what sense you are trying to go with this, but if you are trying to compare 2 at a time, you should probably use isDate() first... If the 01/01/1900 is supposed to be a date, then an invalid value is passed in.

    I hope this helps...

  • To loop through the table and use the values returned in another query

    Hello

    I tried to do something very simple, but still can not.

    I am trying to iterate on a table and use each line of a column in a where clause to display a query clause.

    For example:

    I want to retrieve all users of dba_users pass it to a clause where clause in a query to show for example account_status and profile of each user. But I want to do it in a way if I can turn the result in an html table.

    I tried too much really, so I'll post something that does not work, but which I think will show the problem I have,

    BEGIN
     FOR i IN (SELECT username from dba_users order by 1)
     LOOP
     EXECUTE IMMEDIATE 'select account_status from dba_users where username like ''||i.username||''';
     END LOOP;
     END;
     /
    

    Example of what I want to achieve:

    Suppose that there are two users, SYS, and SCOTT:

    USERNAME                       PROFILE                        ACCOUNT_STATUS
    ------------------------------ ------------------------------ --------------------------------
    SYS                            DEFAULT                        OPEN
    
    
    USERNAME                       PROFILE                        ACCOUNT_STATUS
    ------------------------------ ------------------------------ --------------------------------
    SCOTT                            DEFAULT                        OPEN
    

    Thanks in advance for your time,

    OD

    Hi Bill,

    Bill Citad kirjoitti:

    What a join or a sub query going to help me? honestly

    -- join
    select
      s.sql_id,
      h.loads_total
    from dba_hist_sqlstat h join v$sql s on (
      h.sql_id = s.sql_id
    )
    where rownum < 3
    ;
    
    -- subquery
    select
      sql_id,
      loads_total
    from dba_hist_sqlstat
    where sql_id in (
      select sql_id from v$sql where rownum < 3
    )
    ;
    
    -- correlated subquery
    select
      sql_id,
      loads_total
    from dba_hist_sqlstat
    where exists (
      select null from v$sql where sql_id = dba_hist_sqlstat.sql_id
    )
    and rownum < 3
    ;
    
    -- lateral inline view (12c)
    select
      s.sql_id,
      h.loads_total
    from dba_hist_sqlstat, lateral(
      select sql_id from v$sql where sql_id = h.sql_id
    ) s
    where rownum < 3
    ;
    
  • How to have a variable the function "return" have more than one value

    @using the Sub function how can user_id accepts the values 0 and 6?

    create or replace function xxactive_user_test)

    p_schema in varchar2,

    p_object in varchar2)

    return varchar2

    as

    Start

    return 'user_id = 0';

    end;

    /

    Post edited by: 880492

    The question or needs is not clear, to me at least.

    > How user_id can take the values 0 and 6

    How the function is used.

    You mean like this:

    return 'user_id IN (0,6)';
    
  • Mower esxcli the values that are returned in Powercli

    Hi guys,.

    Has anyone managed to adjust the value returned when executing esxcli via powershell

    For example

    $myhost = get-vmhost-name esx01

    $esxcli = get-EsxCli - VMHost $myhost

    $esxcli.system.coredump.network.get () | FT Enabled

    Capture.JPG

    I'm looking for Trim the true -Enabled - to output html.

    Capture.JPG

    Any idea?

    Concerning

    Cliff

    Not sure I have the question, but the output of the Get-EsxCli commands are objects.

    You can not just do?

    $myhost = get-vmhost-name esx01

    $esxcli = get-EsxCli - VMHost $myhost

    $enabled = $esxcli.system.coredump.network.get () | -ExpandProperty allowed to select

  • calibrate the values of 12-bit ADC

    I'd like to understand how to convert integer values of a 12-bit ADC in tensions. I use a box NI USB-6008 in differential input mode. It is 12 bits of resolution in differential mode.  I use a simple VI to collect 100 samples of the differential analog input voltage 0 (AI0).  When I connect AI0 + and -AI0, the tension between them must be zero.  When I traced the number returned by the routine of the CQI data, I see-32768 values most of the time over a few jumps to + 32752.  When to convert format I16 U16 format numbers. I see values ot + 32 768 for the most part, as well as a few jumps to + 32752.See attached shot of front block diagram of the display panel.

    Looks like Labview add 4 zeros at the end of the right hand of the binary number 12 bit returned by CDA.  Is there a simple way to make ADC return numbers like 0, + 1, -1, when the voltage is about zero?  I could do the following:

    1 convert the values returned by the ADC since I16 to U16.

    2 divide by 16.

    3 subtract 2048.

    I teach students about the basics of analog digital conversion, and I don't want to have to explain this clumsy scheme, if I can avoid it.

    Thank you.

    Bill

    Hi Bill,

    Looks like you've discovered the complement representation two that LabVIEW uses to represent signed integers. Not adjusted data are drawn directly on the hardware registers and are represented as they are on the unit.

    If you want to convert the values, you can convert as you have indicated. You can also take the opportunity to explain the complement to two of them if it's as part of your course, or you can just put the arithmetic in a VI if you want to hide.

    If you look at the unsigned values, you could also explain to them that it is in the voltage range, the value is.

    For example, 16-bit unsigned gives a range of 0-65535. If you have selected the voltage range is-10 to + 10 v. If you have 0V, so you should expect a reading around 32768.

    Here's the wikipedia article on the complement of two for reference: http://en.wikipedia.org/wiki/Two's_complement

  • Collect the value of edittext box &amp; menu drop-down list to manipulate the project

    I built a simple GUI with a dropdown Panel and three boxes of edittext. I know not how to retrieve the values of each object to pass to the ASP (layers of text, project items). I'm still confussed on how to the onClick, onChange, onDeactivate, etc. methods work with functions... If I want to for example, to take the values in the boxes edittext to change values to text in a model layer, how could - I collect these values and pass them? In the sample code below it passes the default values for areas of edittext straight for layers of text in the model as soon as the GUI is launched...

    myGUI (this);

    function myGUI (thisObj) {}

    var myGUIPalette = myGUI_buildUI (thisObj);

    function myGUI_buildUI (thisObj) {}

    var myPanel = (thisObj instanceof Panel)? thisObj: new window ("palette", "user input panel', undefined, {resizable: true}");

    {//Build GUI

    res = "group {orientation:"column",-}".

    titleGroup: group {orientation: 'row', \}

    myStaticText: StaticText {text: 'Handset team word interludes'}, \

    },\

    textLineGroup: Panel {orientation: "column,"------}

    teamList:DropDownList {properties: {items: ['SORT CODES', '-', "ARI", "ATL", "BALL"]}}, \

    line01: EditText {}, \

    line02: EditText {}, \

    line03: EditText {}, \

    },\

    'ButtonGroup': group {orientation: 'row', \}

    clearButton: button {text: 'Clear'}, \

    renderButton: button {text: 'Making'}, \

    },\

    }";

    }

    myPanel.grp = myPanel.add (res);

    Default values

    var myPanel.grp.textLineGroup = textBox;

    textBox.teamList.selection = 0;

    textBox.line02.visible = false;

    textBox.line03.visible = false;

    var button = myPanel.grp.buttonGroup;

    var textBoxSize = (200, 20);

    var textBoxCharacters = 30;

    textBox.line01.size = textBoxSize;

    textBox.line01.characters = textBoxCharacters;

    textBox.line02.characters = textBoxCharacters;

    textBox.line03.characters = textBoxCharacters;

    Text box settings

    var defaultText01 = "enter the text of the line 01 ';

    var defaultText02 = "enter the text of the line 02."

    var defaultText03 = "enter line 03 Text."

    var myPanel.grp.textLineGroup = textBox;

    textBox.line01.text = defaultText01;

    textBox.line02.text = defaultText02;

    textBox.line03.text = defaultText03;

    textBox.line01.onActivate = function() {setTextBox (textBox.line01, defaultText01)};

    textBox.line02.onActivate = function() {setTextBox (textBox.line02, defaultText02)};

    textBox.line03.onActivate = function() {setTextBox (textBox.line03, defaultText03)};

    function setTextBox (activeTextBox, defaultText) {}

    if(activeTextBox.Text == DefaultText) {}

    activeTextBox.text = "";

    }

    activeTextBox.onDeactivate = function() {}

    If (activeTextBox.text == "") {}

    activeTextBox.text = defaultText;

    }

    ElseIf (activeTextBox == textBox.line01) {}

    textBox.line02.visible = true;

    }

    ElseIf (activeTextBox == textBox.line02) {}

    textBox.line03.visible = true;

    }

    };

    }

    var teamTri;

    textBox.teamList.onChange = function() {teamTri = textBox.teamList.selection};

    Settings button

    button.clearButton.onClick = function() {}

    textBox.line01.active = false;

    textBox.line02.active = false;

    textBox.line03.active = false;

    textBox.line02.visible = false;

    textBox.line03.visible = false;

    textBox.teamList.selection = 0;

    textBox.line01.text = defaultText01;

    textBox.line02.text = defaultText02;

    textBox.line03.text = defaultText03;

    }

    Manipulate the AE project

    ////////////////////////////////////

    ////////////////////////////////////

    #include "/ GFXM1/Script_Workflows/commonFunctions.jsx".

    var targetWidth;  Horizontal limit for altered text layers

    var modifiedLayers = new Array();

    numItems = app.project.items.length; collect the number of project items

    var teamLogosFolderMov = locateProjItems (FolderItem, "teamLogosMov");  Use CompItem to comps

    var teamLogosFolderRaster = locateProjItems (FolderItem, "teamLogosRaster");  Use CompItem to comps

    var teamLogosFolderVector = locateProjItems (FolderItem, "teamLogosVector");  Use CompItem to comps

    If (textBox.line03.text! = ' ': textBox.line03.text! = defaultText03) {}

    lineValue = textBox.line01.text + textBox.line02.text + "\r\n" + "\r\n", textBox.line03.text;

    }

    ElseIf (textBox.line02.text! = ' ': textBox.line02.text! = defaultText03) {}

    lineValue = textBox.line01.text + "\r\n" + textBox.line02.text;

    }

    else {lineValue = textBox.line01.text ;}

    for (c = 1; c < = numItems; c ++) {}

    model var = app.project.items [c];

    If (comp instanceof CompItem) {}

    for (i = 1; i < = comp.numLayers; i ++) {}

    {Switch (COMP. Layer (i). Name)}

    case 'textLines_GD ':

    targetWidth = 1720;

    setTextLayer_caseSensitive (comp.layer (i), lineValue);

    projectName = lineValue;

    If (scaleTextLayer (COMP. Layer (i), comp.layer (i).sourceRectAtTime(1,_true).width, targetWidth)) {}

    modifiedLayers.push (comp.layer (i));

    }

    break;

    case 'teamLogo_GD ':

    var numFolderItems = teamLogosFolderMov.numItems; Get the number of items in the folder teamLogos

    swapTeamLogo (numFolderItems, teamLogosFolderMov, teamTri, comp.layer (i));

    break;

    }

    }

    }

    }

    function swapTeamLogo (numFolderItems, teamLogosFolder, teamTri, layer) {}

    for (b = 1; b < = numFolderItems; b ++) {/ / loop in the teamLogos folder}

    If (teamLogosFolder.item (b) .name == teamTri) {/ / Check for game}

    layer.replaceSource (teamLogosFolder.item (b), true);  team swap in comp teamLogo logo

    }

    } //end check the teamLogos folder

    }

    ////////////////////////////////////

    ////////////////////////////////////

    Return myPanel;

    }

    If ((myGUIPalette! = null) & & (myGUIPalette instanceof window)) {}

    myGUIPalette.center ();

    myGUIPalette.show ();

    }

    }

    Hello, if your range variables are in the scope of your function (which is the case here) you need not pass them as arguments to your function.

    Then you can simply activate what wrote you in a function already and call on events, something like this:

    doIt() function

    {

    var

    targetWidth, numFolderItems, lineValue, ProjectName

    modifiedLayers = new Array(),

    numItems = app.project.items.length; collect the number of project items

    teamLogosFolderMov = locateProjItems (FolderItem, "teamLogosMov"), //Use CompItem for comps

    teamLogosFolderRaster = locateProjItems (FolderItem, "teamLogosRaster"), //Use CompItem for comps

    teamLogosFolderVector = locateProjItems (FolderItem, "teamLogosVector"), //Use CompItem for comps

    model,

    I, c;

    If (textBox.line03.text! = ' ': textBox.line03.text! = defaultText03) lineValue = textBox.line01.text + textBox.line02.text + "\r\n" + "\r\n", textBox.line03.text

    ElseIf (textBox.line02.text! = ' ': textBox.line02.text! = defaultText03) lineValue = textBox.line01.text + "\r\n" + textBox.line02.text

    else lineValue = textBox.line01.text;

    for (c = 1; c<= numitems;="" c++)="" if="" (="" (comp="app.project.item(c))" instanceof="">

    {

    for (i = 1; i<= comp.numlayers;="" i++)="">

    {

    case 'textLines_GD ':

    targetWidth = 1720;

    setTextLayer_caseSensitive (comp.layer (i), lineValue);

    projectName = lineValue;

    If (scaleTextLayer (COMP. Layer (i), comp.layer (i).sourceRectAtTime(1,_true).width, targetWidth)) modifiedLayers.push (comp.layer (i));

    break;

    case 'teamLogo_GD ':

    numFolderItems = teamLogosFolderMov.numItems; Get the number of items in the folder teamLogos

    swapTeamLogo (numFolderItems, teamLogosFolderMov, teamTri, comp.layer (i));

    break;

    default:;

    };

    };

    };

    myPanel.grp.buttonGroup.renderButton.onClick = needs;

    If instead you want to write a function that is independent from the UI variables, IE not dependent on variables of string, then you must pass these values as arguments:

    function must (text01 text02 text03, defaultText01, defaultText02, defaultText03)

    {

    same start

    get lineValue of arguments

    lineValue = text01; If (text02! = "" |) Text02! = defaultText02) {lineValue += "\r\n" + text02;}  If (text03! = "" |) Text03! = defaultText03) lineValue += "\r\n" + text03 ;} ;

    same end

    };

    myPanel.grp.buttonGroup.renderButton.onClick = function() {has (textBox.line01.text, textBox.line02.text, textBox.line03.text, defaultText01, defaultText02, defaultText03) ;};

    Note: I changed my computer var = app.project.items [c]; (does not work) to comp = app.project.item (c); and if (textBox.line02.text! = ' ' | textBox.line02.text! = defaultText03) (risky) if (textBox.line02.text! = ' ': textBox.line02.text! = defaultText03).

    Xavier.

Maybe you are looking for