Need help to convert a sql query to a stored procedure

I have a task to convert a script sql in a stored precedure. The sql with different pr_id test_type are below. And the stored procedure must accept a pr_id and a test_type as an argument. Test type will be 3 for ATI and 2 for TI.  It must return a single value, the greatest distance calculated to fill the value of tap.  It is possible that they will pass a prid, test_type combination that will have all the records in the dsltdr table.

{
SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464529581
AND test_type = 3
ORDER BY pw CSA;
}



SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464528353
AND test_type = 3
ORDER BY pw CSA;


SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464527142
AND test_type = 2
ORDER BY pw CSA;


SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464528984
AND test_type = 2
ORDER BY pw CSA;



>

SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464529918
AND test_type = 2
ORDER BY pw CSA;

How to start with?

Thanks in advance.

I removed the dbms_output statement because it does not seem to turn it on. If you do this from sqlplus
Make sure that you type "serverout on" and press return.

declare
vPW number := 0 ;
vDistance number := 0 ;
begin
sp_dsl_test(3,'12345',vDistance,vPW) ;
DBMS_OUTPUT.PUT_LINE('Distance = '|| vDistance || ' PW = '|| vPW);
end;

Published by: FlyingGuy on March 3, 2011 14:24

Tags: Database

Similar Questions

  • Need help to write a SQL query complex

    I have the source tabe as below

    -> SOURCE_TABLE
    NAME     CUST_ID     SVC_ST_DT     SVC_END_DT 
    TOM        1               31/08/2009      23/03/2011 
    DOCK       2               01/01/2004      31/05/2010 
    HARRY      3               28/02/2007      31/12/2009 
    I want to load as target table below
    -> TARGET_TABLE
    NAME     CUST_ID                     SVC_ST_DT      SVC_END_DT 
    TOM      1           31/08/2009      31/12/2009 
    TOM      1           01/01/2010      31/12/2010 
    TOM      1           01/01/2011      23/03/2011 
    DOCK      2           01/01/2004      31/12/2004 
    DOCK      2           01/01/2005      31/12/2005 
    DOCK      2           01/01/2006      31/12/2006 
    DOCK      2           01/01/2007      31/12/2007 
    DOCK      2           01/01/2008      31/12/2008 
    DOCK      2           01/01/2009      31/12/2009 
    DOCK      2           01/01/2010      31/05/2010 
    HARRY      3           28/02/2007      31/12/2007 
    HARRY      3           01/01/2008      31/12/2008 
    HARRY      3           01/01/2009      31/12/2009 
    Is it possible to write a SQL query that returns the data in the same way above the target table.

    Published by: AChatterjee on April 30, 2012 07:14

    Published by: AChatterjee on April 30, 2012 07:14

    Or like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'TOM' as NAME, 1 as CUST_ID, date '2009-08-31' as SVC_ST_DT, date '2011-03-23' as SVC_END_DT from dual union all
      2             select 'DOCK', 2, date '2004-01-01', date '2010-05-31' from dual union all
      3             select 'HARRY', 3, date '2007-02-28', date '2009-12-31' from dual)
      4  --
      5  -- end of test data
      6  --
      7  select name, cust_id, svc_st_dt, svc_end_dt
      8  from (
      9        select name
     10              ,cust_id
     11              ,greatest(svc_st_dt, add_months(trunc(svc_st_dt,'YYYY'),yr*12)) as svc_st_dt
     12              ,least(svc_end_dt, add_months(trunc(svc_st_dt,'YYYY'),(yr+1)*12)-1) as svc_end_dt
     13        from t
     14             cross join (select rownum-1 as yr
     15                         from   dual
     16                         connect by rownum <= (select extract(year from max(svc_end_dt)) - extract(year from min(svc_st_dt)) + 1 from t)
     17                        )
     18       )
     19  where svc_st_dt <= svc_end_dt
     20* order by 2, 3
    SQL> /
    
    NAME     CUST_ID SVC_ST_DT            SVC_END_DT
    ----- ---------- -------------------- --------------------
    TOM            1 31-AUG-2009 00:00:00 31-DEC-2009 00:00:00
    TOM            1 01-JAN-2010 00:00:00 31-DEC-2010 00:00:00
    TOM            1 01-JAN-2011 00:00:00 23-MAR-2011 00:00:00
    DOCK           2 01-JAN-2004 00:00:00 31-DEC-2004 00:00:00
    DOCK           2 01-JAN-2005 00:00:00 31-DEC-2005 00:00:00
    DOCK           2 01-JAN-2006 00:00:00 31-DEC-2006 00:00:00
    DOCK           2 01-JAN-2007 00:00:00 31-DEC-2007 00:00:00
    DOCK           2 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00
    DOCK           2 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00
    DOCK           2 01-JAN-2010 00:00:00 31-MAY-2010 00:00:00
    HARRY          3 28-FEB-2007 00:00:00 31-DEC-2007 00:00:00
    HARRY          3 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00
    HARRY          3 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00
    
    13 rows selected.
    
  • Need help to write the SQL query

    Hello
    Please help me to write a query. My requirement is as below.

    Hello
    I have a table say XYZ in the following format.

    product_id local min_order_quntity
    ========================================
    1 en 10
    1 ch 10
    2 en 20
    2 ch 20
    3 en 30
    3 ch 30
    4 en 40
    4 NC 10

    Now I want to find the product_id where min_order_quantity is different for cn and locale

    now I want the result of the following

    product_id local min_order_quantity
    =============================================
    4          en          40
    4 ch 10

    This is different for local in and cn for product_id 4 min_order_quantity

    min_order_quantity should be the same for both the locale(en,ch) for any product_id.

    I want to find the product_id where min_order_quantity is different for ch and fr local

    Thank you..

    Hello

    This query should do the job

    select * from xyz t1
    where exists ( select 1 from xyz t2 where t2.product_id = t1.product_id and
                   t2.locale != t1.locale and t2.min_order_quantity != t1.min_order_quantity );
    

    See you soon

  • Need help to build the SQL query

    Hi all

    I struggle to create the select statement.

    This is my expected outcome:

    Insert into tmp (aa, bb, cc, dd)

    values('CUST1','10100001',2,'10-Jan-2013');

    Insert into tmp (aa, bb, cc, dd)

    values('CUST1','10100002',4,'11-Jan-2013');

    Insert into tmp (aa, bb, cc, dd)

    values('CUST2','10200001',2,'19-Jan-2013');

    Insert into tmp (aa, bb, cc, dd)

    values('CUST2','10200002',6,'28-Jan-2013');

    Insert into tmp (aa, bb, cc, dd)

    values('CUST2','10200003',1,'28-Mar-2013');

    My result is:

    AA COUNT (1) MAX (DD) by cc dd AA AA

    CUST1 2 10100002 4 11 January 2013

    CUST2 3 10200003 1 28 MARCH 2013

    Can someone help with the select statement?

    Thank you and best regards,

    Iwan

    Just change it to the column:

    SELECT

    AA

    COUNT (aa)

    , MAX (bb) keep (last dense_rank command by JJ)

    , MAX (cc) keep (last dense_rank command by JJ)

    MAX (dd)

    OF THE TMP

    GROUP BY aa

    ORDER BY aa

    Note that by default sort order is ascending with the last NULL values.

    If in case your line-date-max will contain null value in the bb or cc columns those will be returned.

    Post edited by: Correction of chris227

    Post edited by: chris227 added note

  • Need help to write a sub query

    Our environment - Oracle 10 g

    Hi all
    Need help to write a sub query to reach him here are examples of data using which iam trying to replace the value column in the table based on two other columns in the same table

    Examples of data

    ClaimNo flag LineNo Procedurecode
    100 01 N MN4567
    100 02 Y 7863
    100 03 N MN8976
    100 04 Y 9000
    101 01 Y 8954
    101 02 N MN6754
    101 03 N MN7654
    101 04 Y 8976
    102 01 Y 1234
    102 02 Y 2345
    102 03 Y 3456
    102 03 Y 4567

    Each column of ClaimNo has several rows of data. But if column procedurecode for a claimNo starts with MN then all values associated with the claimno for the flag column should replace N

    If the data must become like below

    ClaimNo flag LineNo Procedurecode
    100 01 N MN4567
    100 02 N 7863
    100 03 N MN8976
    100 04 N 9000
    101 01 N 8954
    101 02 N MN6754
    101 03 N MN7654
    101 04 N 8976
    102 01 Y 1234
    102 02 Y 2345
    102 03 Y 3456
    102 03 Y 4567


    Thank you

    See the example:

    with t as (
                  select 100 ClaimNo, '01' LineNo, 'N' Flag, 'MN4567' Procedurecode from dual
        union all select 100, '02', 'Y', '7863' from dual
        union all select 100, '03', 'N', 'MN8976' from dual
        union all select 100, '04', 'Y', '9000' from dual
        union all select 101, '01', 'Y', '8954' from dual
        union all select 101, '02', 'N', 'MN6754' from dual
        union all select 101, '03', 'N', 'MN7654' from dual
        union all select 101, '04', 'Y', '8976' from dual
        union all select 102, '01', 'Y', '1234' from dual
        union all select 102, '02', 'Y', '2345' from dual
        union all select 102, '03', 'Y', '3456' from dual
        union all select 102, '03', 'Y', '4567' from dual
    )
    select
        claimno,
        lineno,
        flag,
        case
          when count(decode(substr(procedurecode,1,2),'MN',1)) over(partition by claimno)>0
            then 'N'
          else flag
        end new_flag,
        procedurecode
    from t
    

    Kind regards
    Sayan M.

  • I need to return the result of a query on a stored procedure

    I need to return the result of a query to a stored procedure, I mean when I run a stored procedure it returns a result set in a select statement.
    Best regards...

    Hello.

    Do you really want a stored procedure for this?
    Why not just a script that contains the query?

    Assuming that you don't really want a stored procedure, you'll have to decide what to do with the results.
    An option is a slider.

    For example, you can write a procedure of this type to hold the query:

    CREATE OR REPLACE PROCEDURE USP_TEST
    (     out_cursor     OUT     SYS_REFCURSOR
    )
    IS
    BEGIN
         OPEN  out_cursor
         FOR     SELECT     *
              FROM     scott.emp;
    END  USP_TEST;
    /
    SHOW ERRORS
    

    You can move the cursor to another procedure for handling.

    You could test this in SQL * more by creating a variable blond:

    VARIABLE     usp_test_cursor     REFCURSOR;
    
    EXEC  usp_test (:usp_test_cursor);
    
    PRINT     :usp_test_cursor
    
  • How can I transfer content from an XML file in a MS SQL database of the stored procedure using LabWindows/CVI SQL Toolkit?

    Hello

    I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...

    HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport " ... ");

    resCode = DBExecutePreparedSQL (hstmt);

    resCode = DBClosePreparedSQL (hstmt);

    ... but in this case, I am not able to read the return value of the stored procedure.

    I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?

    No idea how to solve my problem?

    Cake of KR

    DianaS salvation,

    Thanks for your comments. During this time I found another way which fullfill my needs:

    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);

    sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
    HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);

    While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)

    {

    / * Enter values in the record. */

    resCode = DBGetColInt (hstmt, 1, & s32_TestId);
    }

    resCode = DBDeactivateSQL (hstmt);

    sz_Buffer is the content of the XML file.

    Cake of KR

  • need help to convert this procedure used and call in coldfusion

    Hi I'm new to coldfusion and I haed of the code with me and I need it to convert in the stored procedure and will call back within coldfusion. Can someone help me how to make these data to the stored procedure and calling in coldfusion.

    Here is the code of my

    SET NOCOUNT ON

    DECLARE
    @cpt_dpt_cd char (2)
    @cpt_com_cd char (3)
    @sub_com_cd char (5)
    @con_upc_no char (13)
    , @pid_lng_dsc_tx varchar (100)
    , @pid_sht_dsc_tx varchar (100)
    , @rev_by varchar (8)
    @rev_dt datetime


    DECLARE upc_cursor CURSOR FOR
    SELECT *.
    OF di_audit_corp_upc_ldr_tbl
    WHERE con_upc_no IN ((in English only)
    SELECT con_upc_no, COUNT (*)
    TABLE [dbo]. [di_audit_corp_upc_ldr_tbl]
    GROUP BY con_upc_no
    HAVING COUNT (*) > 1
    )
    ORDER BY con_upc_no

    OPEN upc_cursor

    -It is performed while the previous extraction is successful.
    FETCH NEXT from upc_cursor
    IN
    @cpt_dpt_cd
    @cpt_com_cd
    @sub_com_cd
    @con_upc_no
    @pid_lng_dsc_tx
    @pid_sht_dsc_tx
    @rev_by
    @rev_dt

    -Check @FETCH_STATUS to see if he has more lines to fetch.
    WHILE @FETCH_STATUS = 0
    BEGIN
    -If not exists
    IF NOT EXISTS)
    SELECT con_upc_no
    OF dbo.di_audit_corp_upc_tbl
    WHERE con_upc_no = @con_upc_no
    )
    BEGIN
    -Insert record
    PRINT "insert UPC: ' + @con_upc_no"

    INSERT INTO dbo.di_audit_corp_upc_tbl)
    rcp_dpt_cd
    cpt_dpt_cd
    cpt_com_cd
    sub_com_cd
    cas_upc_no
    con_upc_no
    con_upc_tx
    pid_lng_dsc_tx
    pid_sht_dsc_tx
    aut_vld_cd
    rev_by
    rev_dt
    ) (VALUES
    '07'
    @cpt_dpt_cd
    @cpt_com_cd
    @sub_com_cd
    '0000000000000'
    @con_upc_no
    @pid_lng_dsc_tx
    @pid_lng_dsc_tx
    @pid_sht_dsc_tx
    , 'N'
    @rev_by
    @rev_dt
    )
    END
    ON THE OTHER


    BEGIN
    -to jump
    PRINT ' UPC to jump: "+ @con_upc_no
    END
    < cftransaction action = "commit" / >
    -It is performed while the previous extraction is successful.
    FETCH NEXT from upc_cursor
    IN
    @cpt_dpt_cd
    @cpt_com_cd
    @sub_com_cd
    @con_upc_no
    @pid_lng_dsc_tx
    @pid_sht_dsc_tx
    @rev_by
    @rev_dt

    END

    CLOSE Upc_cursor
    DEALLOCATE upc_cursor

    If I understand your SQL code you select some records in the di_audit_corp_upc_ldr_tbl table.  For each record in the results, you insert di_audit_corp_upc_tbl if a matching record does not already exist in di_audit_corp_upc_tbl.  If this summary is correct, you could try rewriting your query to avoid using a cursor.

    Something like the example below might work (I have not tested this code).

    INSERT di_audit_corp_upc_tbl (rcp_dpt_cd, cpt_dpt_cd, cpt_com_cd, sub_com_cd, cas_upc_no, con_upc_no, con_upc_tx, pid_lng_dsc_tx, pid_sht_dsc_tx, aut_vld_cd, rev_by, rev_dt)
    SELECT ' 07', cpt_dpt_cd, cpt_com_cd, sub_com_cd, ' 0000000000000', con_upc_no, pid_lng_dsc_tx, pid_lng_dsc_tx, pid_sht_dsc_tx, "n", rev_by, rev_dt
    From di_audit_corp_upc_ldr_tbl
    WHERE THERE IS NO
    (
    SELECT *.
    OF di_audit_corp_upc_tbl AS B
    WHERE B.con_upc_no = A.con_upc_no
    ) - check to see if the folder already exists in the destination table
       
    AND
    (
    SELECT COUNT (*)
    FROM di_audit_corp_upc_ldr_tbl AS C
    WHERE C.con_upc_no = A.con_upc_no
    ) > 1 - replaces the HAVING clause in the original query used to select cursor

    Note that I assume you are using Microsoft SQL Server.

    For questions about the improvement of SQL queries you could be better off the coast to post this kind of question on a specific forum for the database server you are using.

  • Question to convert oracle sql query

    Hi friends,

    I have a sql query, as follows,
    Select Name From SysObjects Where XType = 'U' And Name = @Name
    I want to convert this to oracle. I tried to convert this in someways. But I get errors only. Please someone help me solve this problem.

    Thank you
    RAM

    Views of the Oracle dictionary more come in DBA_, ALL_ USER_ flavors. You probably don't have privileges to view DBA_OBJECTS, in which case try object or USER_OBJECTS.

    Of after what I read, you may need something like

    SELECT * FROM all_objects WHERE owner <> 'SYS' AND object_type = 'TABLE'
    

    BTW, a sure way to liquidate Oracle professionals is to use "SQL" to designate another DBMS product, not Structured Query Language. As you may have noticed, we have SQL here as well.

  • Need help! Working with SQL databases

    Hi all

    I am currently working on an application that interacts with a SQL database, and it seems to have hit a roadblock.

    I have a multi-column list box on my front which is filled with the data extracted from the database. By choosing one of the lines in the list box, another opens showing another set of data retrieved by a generated SQL query. At the moment I only select one line at a time to see it has the data, but I want to expand such that I can select mutiple rows in the list both box and see all their relevant data.

    With only one selection, I can switch the index value of the selection of a function table of Index with the database as another entry and build my SQL statement.

    But with multiple choices, I guess I have to build a table on the index values and use them as reference to build the SQL statement. And I don't know how exactly to do that.

    Here is the code that I currently work for a single selection in the drop-down list.

    Any help is appreciated. See you soon.

    tdog says:

    Hi all

    I am currently working on an application that interacts with a SQL database, and it seems to have hit a roadblock.

    I have a multi-column list box on my front which is filled with the data extracted from the database. By choosing one of the lines in the list box, another opens showing another set of data retrieved by a generated SQL query. At the moment I only select one line at a time to see it has the data, but I want to expand such that I can select mutiple rows in the list both box and see all their relevant data.

    With only one selection, I can switch the index value of the selection of a function table of Index with the database as another entry and build my SQL statement.

    But with multiple choices, I guess I have to build a table on the index values and use them as reference to build the SQL statement. And I don't know how exactly to do that.

    Here is the code that I currently work for a single selection in the drop-down list.

    Any help is appreciated. See you soon.

    Regarding the table of construction:

    I can see Hat multicolumn listbox you have multiselection enabled and is limited to one or zero element selected at a time. To allow multiselction; Done just right click your multi-column listbox and change your selection to support multiple selected items. The NewVal to the structure of the event should change to a single index number in a 1 d of the numbers indexed table. No coding required. Then just to retrieve all items (since you know the index) and create the quiry. Quiry part, I'm not really (long time no see SQL), but it looks like a loop for to create the chain should do the trick?

  • Please help me with this SQL query

    I'm practicing of SQL queries and met one involving the extraction of data from 3 different tables.

    The three paintings are as below

    < pre >
    Country
    Location_id country
    LOC1 Spain
    loc2 England
    LOC3 Spain
    loc4 USA
    loc5 Italy
    loc6 USA
    loc7 USA
    < / pre >
    < pre >


    User
    user_id location_id
    loc1 U1
    loc1 U2
    loc2 U3
    loc2 U4
    loc1 U5
    U6 loc3
    < / pre >
    < pre >


    Publish
    user_id post_id
    P1 u1
    P2 u1
    U2 P3
    P4 u3
    P5 u1
    P6 u2
    < / pre >

    I am trying to write a SQL query - for each country of the users, showing the average number of positions

    I understand the logic behind all this that we must first consolidate all locations, and then the users in one country and then find the way to their positions.
    But, I'm having a difficulty to this format SQL. Could someone help me please with this request.

    Thank you.

    Select
    Country.Country,
    Count (*) Totalpostspercountry,
    Count (distinct post.user_id) Totaldistincuserspercountry,
    count (*) / count (distinct post.user_id) Avgpostsperuserbycountry
    Of
    countries, have, post
    where country.location_id = muser.location_id
    and muser.user_id = post.user_id
    Country.country group

    The output is like this for your sample data - hope that's what you're looking for :)

    COUNTRY, TOTALPOSTSPERCOUNTRY, TOTALDISTINCUSERSPERCOUNTRY, AVGPOSTSPERUSERBYCOUNTRY
    In England, 1, 1, 1.
    Spain, 5, 2, 2.5.

  • Help with APP_USER in SQL query

    Hello

    I would like to extract a detail of the user in a form of language element DML based on the logged in user and the standard authentication scheme.

    I make this request in the element:
     select ANALYST_FIRST_NAME ||' '|| ANALYST_LAST_NAME d, ANALYST_ID r from QTMT_ANALYST where EMAIL = :APP_USER 
    The user in the session is equal to the value of the EMAIL. In fact, the value in the session is a capital letter, and the other in the database is tiny. I think that's irrelevant anyway.

    The query do not of any value. Could you please let me know what I did wrong?

    APEX: 4.2
    Item Source type: query SQL (single return value)

    Thank you and best regards,

    Vladimir

    To be on the safe side you should uppercase both sides of the equation. It could be that the user name is entered in lowercase.

    But if you think that your request is correct, test it by using a literal rather than the user name.

    select ANALYST_FIRST_NAME ||' '|| ANALYST_LAST_NAME d
    from QTMT_ANALYST
    where upper(EMAIL) = upper(:APP_USER);
    

    for testing purposes, use something like this:

    select ANALYST_FIRST_NAME ||' '|| ANALYST_LAST_NAME d
    from QTMT_ANALYST
    where upper(EMAIL) = upper('[email protected]');
    

    Published by: Sven w. October 23, 2012 13:30

    APEX: 4.2
    Item Source type: SQL Query ( return a single value )

    I just noticed that you use an element that has this as the SQL source. This only works if the sql returns a row and a column only. That's why I removed the second column in your query.

    Published by: Sven w. October 23, 2012 13:33

  • Charger (need help to convert AS2 AS3)

    Because I know that this code works very well and that I use it in one of my flash AS3, I need it in one of my flash AS2 and I do not know how to adapt. I searched more than 100 threads and I can not find something similar... Thank you to help me make it work in AS2! As I need in AS2, I thought it would be the right place to post.

    I posted the entire process of loading code, but I need help especially with the charger part. How to do this in AS2? Thank you!

    var img = 0;
    var image_total = 0;

    var myImages_array:Array = new Array();
    var myBitmaps_array:Array = new Array();

    function Init();

    {

    Image URLS is loaded into a table before this call
    LoadImage();

    }


    function LoadImage()
    {
    If (img, myImages_array.length) / / img is the index of the current image and myImages_array is my URL table
    {

    I need help with this framework, you can
    var loader: Loader = new Loader();

    / / Returns the full path of the image and load it
    Loader.Load (new URLRequest (my_site_url + myImages_array [img]));
    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);

    }
    on the other
    {
    If (count == 0)
    {

    When everything is loaded, I'll start loading my Bitmaps in a short slide show
    Count += 1;
    init_slideshow();
    }
    }
    }

    function imageLoaded(e:Event):void
    {
    Bitmap of the image: var = e.target.content;

    Bitmap manipulation (deleted) here

    image_total = myBitmaps_array.push (image);

    If (img < myImages_array.length)
    {
    IMG += 1;

    Call the following image
    LoadImage();
    }
    }

    function init_slideshow (): void
    {

    The current index for the first Reserts
    IMG = 0;

    Start the slide show, since everything is loaded
    animate_slideshow();
    }

    Look at the MoveClipLoader class and the addListener method that supports.

  • Need to query to find stored procedures that takes great execution time

    Hi all

    I use the oracle version below:

    Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for Linux: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    is it possible to find the name of stored procedure that take too long to run, I need those optimized all SPs.

    Is there a query as top queries that are used to find queries albums that have great time for execution...

    or y at - it another way to find the names of MS. I try with AWR report but showing only used the names of MS.

    Thank you

    No, it not there no such request as far as I know.

    or y at - it another way to find the names of MS.

    Just listen to complaints from the user...

  • Need to query in a stored procedure

    Hi all

    I need to create a stored procedure that does not take any parameter, it's simply an SP which only made the update.

    I update two tables here twice, I update the tables matched_news and matched_news_industries under certain conditions.

    I update two tables twice and after two update tables once, I need to update another table is gm_sector_activity_tracker table, in this update that I need
    update of is_transfered = 'Y' where is_transfered = "M" but I need to update only the rows that are updated in above two updates.

    It means assume that my above two updated day to day only 4 rows, so I need to update the records in the gm_sector_activity_tracker table.

    Here's the code for MS:

    CREATE OR REPLACE PROCEDURE SI_UPDATE_SOURCES_LOGO_PDF AS

    BEGIN

    update of matched_news one

    Set logo_source = (select distinct source_logo from news_sources

    where channel_id = a.channel_id

    and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am')

    and 'a.newS_type =' Reports

    and a.LOGO_SOURCE is null

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177));

    COMMIT;

    update of matched_news_industries one

    Set logo_source = (select distinct source_logo from news_sources

    where channel_id = a.channel_id

    and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am')

    and 'a.newS_type =' Reports

    and a.LOGO_SOURCE is null

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177));

    COMMIT;

    / * Once this is done, we need to update the table "gm_sector_activity_tracker" column is_transferred = 'Y' where is_transferred = am' one by one.* /

    Matched_News update

    source_name = value (select distinct (ltrim (rtrim (source_name))) of channel_source_type)

    WHERE CHANNEL_ID = A.CHANNEL_ID

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'))

    where exists (select channel_source_type source_name

    where channel_id = a.channel_id

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'));

    COMMIT;

    Update matched_news_industries has

    source_name = value (select distinct (ltrim (rtrim (source_name))) of channel_source_type)

    WHERE CHANNEL_ID = A.CHANNEL_ID

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'))

    where exists (select channel_source_type source_name

    where channel_id = a.channel_id

    and ONTO_ID = a.ONTO_ID

    and a.channel_id not in (6522,6835,6944,6945,6946,7189,8396,8397,8398,5395,9176,9177)

    and 'a.news_type =' Reports

    and a.auto_status = 'Categorized'

    and a.news_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am'));

    COMMIT;

    / * Once this is done, we need to update the table "gm_sector_activity_tracker" column is_transferred = 'Y' where is_transferred = am' one by one.*.

    END SI_UPDATE_SOURCES_LOGO_PDF;

    Thank you


    Your instructions to update, it's what you do:

    MERGE INTO MATCHED_NEWS HAS

    WITH THE HELP OF NEWS_SOURCES B

    WE (A.CHANNEL_ID = B.CHANNEL_ID)

    WHEN MATCHED THEN

    UPDATE

    SET A.LOGO_SOURCE = B.SOURCE_LOGO

    WHERE A.NEWS_ID IN (NEWS_ID HAS SELECTION SUMMER)

    OF GM_SECTOR_ACTIVITY_TRACKER

    WHERE IS_TRANSFERRED = AM')

    AND A.NEWS_TYPE = 'reports '.

    AND A.LOGO_SOURCE IS NULL

    AND A.CHANNEL_ID NOT IN (6522,

    6835,

    6944,

    6945,

    6946,

    7189,

    8396,

    8397,

    8398,

    5395,

    9176,

    9177);

    You can do the same for the other tables as separate MERGE one after the other.

Maybe you are looking for

  • image library

    picture library does not open when I click on it... a box Monte States photo library - ms "is not working anymore..." How can I fix this i have hundreds of photos out there not to mention the songs

  • Satellite Pro A60 PSA65E black screen when you wake up from stand-by

    Hello I have a laptop computer (PSA65E) A60 and I am really slow recently so I decided to reinstall windows XP. I didn't have the CD that came with the laptop, so I don't know if it was an installation CD or recovery CD. But I installed WinXP home wi

  • Iomega iConnect

    I have successfully configured the wireless device. When I attach flash storage to the iConnect drive, it appears in Windows Explorer under storage attached to the network and is accessible. However, when I try to join my backup drive Seagate more th

  • Desktop display is upside down

    my video screen from the windows welcome screen shows all the picture and mouse movements backwards. to start the ' hardware intel' screen and the windows xp screen appears correctly, but all the following images are color and resolution correct but

  • Original WRT160N V3 firmware

    I have this problem, Network magic will update the firmware on my router and I noticed that the access restriction tab was gone. should I downgrade the firmware of its originat State and where can I get the firmware with access restriction feature? H