Problems of execution of a SQL function with a variable in the WHERE clause

Hello world!

I have programmed a function that returns a boolean value based on the result of the SQL. It's the function:

FUNCTION existe_secuencial (seq_name VARCHAR2) RETURN AS BOOLEAN

cursor c2 is SELECT FROM all_sequences WHERE upper (sequence_name) = sequence_name' | seq_name | ' ;

BEGIN

OPEN c2;

DBMS_OUTPUT. Put_line (nombre_seq);

Get c2 INTO kk;

If c2% NOTFOUND = True THEN

RETURNS false;

on the other

RETURNS true;

end if;

END existe_secuencial;

And I give the floor to the function of a procedure in this way:

IF existe_secuencial ("SEQ_ARQUETA") = True THEN

DBMS_OUTPUT. Put_line ('exists');

ON THE OTHER

DBMS_OUTPUT. Put_line ("' NOT exists");

END IF;

The probrem that this SQL is forced to return results because this sequence exists in the comic book, but is not, return me the FALSE value. What makes me mad is that if I change the second line of the function in this way:

> > cursor c2 is SELECT FROM all_sequences WHERE upper (sequence_name) sequence_name ="SEQ_ARQUETA";

It works find and return of sequence existing (real)

Can someone help me please, I'm quite desperate to find what is the problem with that because I do not understand why if I built the slider with a variable returns no results so that if I do write it works...

Thanks in advance!

Itziar

Frame you your variable in quotes, which makes the string literal ' |. ' seq_name | "rather than the content of the variable.

I think that something like this would be an improvement.

function existe_secuencial (seq_name VARCHAR2) return a Boolean value as

number of exist_check: = 0;

Start

Start

Select 1

in exist_check

of all_sequences

where upper (sequence_name) = upper (seq_name);

exception

When no_data_found then

null;

end;

return (exist_check = 1);

end existe_secuencial;

Tags: Database

Similar Questions

  • Session variable in the WHERE clause of the SQL statement

    Hey all,.

    I was wonering just if there is a way to set the WHERE clause of the query that the session variable?  I have the following so far and have tried to go through a ton of tutorials, but it doesn't seem to work.  Is it still possible?  I don't know what follows is wrong, but can someone help me with changing the following code, or pointing me to a good tutorial?  (I write it with PHP)

    $query = "SELECT * from members where user_id = ' $_SESSION ['members']";

    Thanks for your help.

    $member = "-1";
    If (isset($_SESSION['members'])) {}
    $member = $_SESSION ['members'];

    }
    $query = "SELECT * from members where user_id = $member;

  • problem with bind variables in the SQL query view object

    Hi all

    I use JDev 11.1.2.4.0.

    I have a problem with bind variables in the SQL query view object.

    This is my original SQL

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE t.nctuser_id = '20022' 
          AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929')
    group by t.legertype_id
    

    In my view .xml object query tab, I am writing this

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE   t.nctuser_id = '20022'
        AND to_char(t.insertdate,'YYYYMMDD') in :dddd
    group by t.legertype_id
    

    Davis here is a variable of Type liaison: String, updatable and necessary.

    I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.

    But failed. The view object retrieves 0 line after that I run.

    Why?

    Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')

    A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.

    Timo

  • Cannot run a «BUSINESS...» WHEN ' with a date in a WHERE CLAUSE condition

    Hello

    I need to check for a condition and date according to the date, he would check a set of host names or the other game... so I thought I could write something like this in the WHERE clause:

    AND HOST_NAME IN

    (

    CASE

    WHEN TO_DATE (: StopDate, 'MON-DD-YYYY') > = TO_DATE ('22 - DEC - 2015 "," DD-MON-YYYY ') THEN

    ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC') ON THE OTHER

    ("SERVERNAME1", "NAMESERVER2", "SERVERNAME3")

    END

    )

    I get the following:

    ORA-00907: lack of right parenthesis

    00907 00000 - "lack the right parenthesis.

    But there is no missing parentheses!

    If I take the case... when... end, and run the host_name in ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC') (separately, they run fine)...

    I also tried:

    AND

    (

    CASE

    WHEN TO_DATE (: StopDate, 'MON-DD-YYYY') > = TO_DATE ('22 - DEC - 2015 "," DD-MON-YYYY ') THEN

    HOST_NAME IN ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC') ELSE

    HOST_NAME IN ('SERVERNAME1","NAMESERVER2","SERVERNAME3")

    END

    )

    the error I get is:

    ORA-00905: lack of keyword

    00905 00000 - 'lack the key word'

    What keyword miss me?

    Post edited by: c75d2e42-06a0-4eb1-a576-5652edcbfbe8

    Hello

    c75d2e42-06a0-4eb1-A576-5652edcbfbe8 wrote:

    It was a typo when transferred to the Oracle forum... the version of Oracle is: PL/SQL version 10.2.0.3.0 (10 G)

    I also used IF the statement and that has not worked (in error "missing parenthesis") which I'm sure is a matter of "syntax"... I did not know that the CASE statement returns the value single only, so it's probably the problem.  Is it possible to re - write this?

    ...

    IF only works in PL/SQL.  It does not in SQL, even if that SQL is embedded in PL/SQL.

    There are many ways to re - write the condition.  And here's one:

    AND ((host_name IN ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC')

    AND TO_DATE (: StopDate, "MON-DD-YYYY") > = TO_DATE ('22-DEC-2015', "MON-DD-YYYY")

    )

    OR (host_name IN ('servername1","Nameserver2","SERVERNAME3")

    AND TO_DATE (: StopDate, "MON-DD-YYYY")<  to_date="" ('dec-22-2015', ="">

    )

    )

    If: StopDate can be NULL, it must be a bit more complicated.

    You can also use nested, such as CASE expressions

    AND THE CASE

    WHEN TO_DATE (: StopDate, "MON-DD-YYYY") > = TO_DATE ('22-DEC-2015', "MON-DD-YYYY")

    WHILE CASE

    WHEN host_name IN ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC')

    AND THEN 'OK '.

    END

    OTHER CASES

    WHEN host_name IN ('servername1","Nameserver2","SERVERNAME3")

    AND THEN 'OK '.

    END

    END = 'OK '.

    I wonder if this in your application is the best way, however.  If SERVERNAMEA was put into service on December 22, maybe that that fact should be recorded in a table.  If you have a table with 1 row per server, you can consider adding 2 columns DATE to show when the server was first and last used.  Then, rather than use a WHERE clause to test servers appropriate, you could do an inner join.

  • Execution of statement of UPDATE for the whole table even when the WHERE Clause is presentation

    Hi friends,

    I have a problem in a stored procedure where I wrote an update with a where clause clause statement. At some point only one line should be updated according to the unique identifier in where clause.

    But what is happening is that the Update statement is getting executed for all rows in the table to neglect the WHERE clause. I don't get any idea of why this is happening. Here is the stored procedure and the update statement is BOLD:-

    CREATE OR REPLACE PROCEDURE MDMADM.proc_MDM_InsertCntryDetails
    (
    CntryMasterCode IN VARCHAR2,
    CntryName IN VARCHAR2,
    MDMUser IN VARCHAR2,
    Exists IN ITS ENTIRETY,
    status in VARCHAR2,
    Inserted_By IN VARCHAR2 default NULL,
    Modified_By IN VARCHAR2 default NULL,
    Mdm_Code IN the DEFAULT NUMBER 0.
    Action in VARCHAR2 DEFAULT 'Add ',.
    XGenAttNames IN VARCHAR2 default NULL,
    XGenAttValues IN VARCHAR2 default NULL,
    MirusAttNames IN VARCHAR2 default NULL,
    MirusAttValues IN VARCHAR2 default NULL,
    GenisysAttNames IN VARCHAR2 default NULL,
    GenisysAttValues IN VARCHAR2 default NULL,
    XGenModify IN VARCHAR2 default NULL,
    MirusModify IN VARCHAR2 default NULL,
    GenisysModify IN VARCHAR2 default NULL
    )

    IS

    strSQLXGen VARCHAR (1000);
    strSQLMirus VARCHAR (1000);
    strSQLGenisys VARCHAR (1000);
    nMaxMDMCode INTEGER.
    ifExist INTEGER;

    /******************************************************************************
    NAME: proc_MDM_InsertCntryDetails
    PURPOSE:

    REVISIONS:
    Worm Date Description of the author
    --------- ---------- --------------- ------------------------------------
    1.0 03/07/2009 1. Created this procedure.

    NOTES:

    Keywords to replace automatically available Auto:
    Object name: proc_MDM_InsertCntryDetails
    SYSDATE: 03/07/2009
    Date and time: 03/07/2009, 19:11:20 and 03/07/2009-19:11:20
    User name: (put in TOAD Options, editor of the procedure)
    Name of the table: (defined in the dialog box "New PL/SQL object")

    ******************************************************************************/
    BEGIN

    COUNT (*) of SELECT INTO ifExist OF MDM_COUNTRY_MASTER;

    IfExist IF = 0 THEN
    SELECT 1 INTO nMaxMDMCode FROM DUAL;
    ON THE OTHER
    SELECT MAX (MDM_CODE) + 1 IN MDM_COUNTRY_MASTER nMaxMDMCode;
    END IF;


    IF Action = "add" THEN

    INSERT INTO MDM_COUNTRY_MASTER(MDM_CODE,MDM_MASTER_CODE,MDM_DESCRIPTION,MDM_USER,MDM_EXIST,MDM_STATUS,MDM_ACTION,DAT_INSERT_DATE,DAT_INSERTED_BY)
    VALUES(nMaxMDMCode,CntryMasterCode,CntryName,MDMUser,exist,Status,action,sysdate,Inserted_By);

    strSQLXGen: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) XGenAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
    "VALUES (' |)" nMaxMDMCode | ',' || '''' || "XGen | '''' || ',1,' || XGenAttValues | ',' || '''' || Inserted_By | '''' || SYSDATE)';

    EXECUTE IMMEDIATE strSQLXGen;

    strSQLMirus: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) MirusAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
    "VALUES (' |)" nMaxMDMCode | ',' || '''' || "Mirus | '''' || ',2,' || MirusAttValues | ',' || '''' || Inserted_By | '''' || SYSDATE)';

    EXECUTE IMMEDIATE strSQLMirus;

    strSQLGenisys: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) GenisysAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
    "VALUES (' |)" nMaxMDMCode | ',' || '''' || "Genisys | '''' || ',3,' || GenisysAttValues | ',' || '''' || Inserted_By | '''' || SYSDATE)';

    EXECUTE IMMEDIATE strSQLGenisys;

    ON THE OTHER



    UPDATE MDM_COUNTRY_MASTER
    SET MDM_DESCRIPTION = CntryName, DAT_MODIFIED_BY = Modified_By, DAT_MODIFY_DATE = SYSDATE.
    MDM_USER = MDMUser, MDM_ACTION = Action, MDM_STATUS = status MDM_EXIST = exist WHERE MDM_CODE = Mdm_Code;




    COUNT (*) of SELECT INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE = 1 AND MDM_CODE = Mdm_Code;

    IfExist IF = 0 THEN

    strSQLXGen: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) XGenAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
    ' VALUES(' ||) Mdm_Code | ',' || '''' || "XGen | '''' || ',1,' || XGenAttValues | ',' || '''' || Modified_By | '''' || SYSDATE)';

    EXECUTE IMMEDIATE strSQLXGen;

    ON THE OTHER
    strSQLXGen: = "UPDATE MDM_COUNTRY_MAPPING SET | XGenModify | ', DAT_MODIFY_DATE = SYSDATE, DAT_MODIFIED_BY =' | '''' || Modified_By | '''' || "WHERE MDM_CODE =' | ' Mdm_Code | "and SYSTEM_CODE = 1';

    EXECUTE IMMEDIATE strSQLXGen;

    END IF;


    COUNT (*) of SELECT INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE = 2 AND MDM_CODE = Mdm_Code;

    IfExist IF = 0 THEN

    strSQLMirus: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) MirusAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
    ' VALUES(' ||) Mdm_Code | ',' || '''' || "Mirus | '''' || ',2,' || MirusAttValues | ',' || '''' || Modified_By | '''' || SYSDATE)';

    EXECUTE IMMEDIATE strSQLMirus;

    ON THE OTHER
    strSQLMirus: = "UPDATE MDM_COUNTRY_MAPPING SET | MirusModify | ', DAT_MODIFY_DATE = SYSDATE, DAT_MODIFIED_BY =' | '''' || Modified_By | '''' || "WHERE MDM_CODE =' | ' Mdm_Code | "and SYSTEM_CODE = 2';

    EXECUTE IMMEDIATE strSQLMirus;

    END IF;


    COUNT (*) of SELECT INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE = 3 AND MDM_CODE = Mdm_Code;

    IfExist IF = 0 THEN

    strSQLGenisys: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) GenisysAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
    ' VALUES(' ||) Mdm_Code | ',' || '''' || "Genisys | '''' || ',3,' || GenisysAttValues | ',' || '''' || Modified_By | '''' || SYSDATE)';

    EXECUTE IMMEDIATE strSQLGenisys;

    ON THE OTHER
    strSQLGenisys: = "UPDATE MDM_COUNTRY_MAPPING SET | GenisysModify | ', DAT_MODIFY_DATE = SYSDATE, DAT_MODIFIED_BY =' | '''' || Modified_By | '''' || "WHERE MDM_CODE =' | ' Mdm_Code | "and SYSTEM_CODE = 3';

    EXECUTE IMMEDIATE strSQLGenisys;

    END IF;



    END IF;



    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHILE OTHERS THEN
    -Consider recording the error and then re-raise
    LIFT;
    END proc_MDM_InsertCntryDetails;
    /


    Thank you

    >
    WHERE mdm_code = mdm_code
    >

    This will always be value true - similar to WHERE 1 = 1.

    You typed it wrong or is the same as the variable column name? If they are the same test rename one of them.

  • Trouble using a function in the where clause

    Hello

    I use a function that is located at ask.tom.oracle.com, which converts a long data type in a character. The function returns an error when it is placed in the where clause. The sql statement, the error message and the function of asking tom are listed below. Does anyone know how to fix this?


    < pre >

    SELECT A.FLDPHYSICAL,
    A.FLDEXPOSURE,
    A.FLDDATEDUE,
    A.FLDDATELAST,
    A.FLDEMPLOYEE,
    B.FLDBDATE,
    B.FLDMAILSTOP,
    B.FLDREC_NUM,
    B.FLDLNAME,
    B.FLDMI,
    B.FLDFNAME,
    B.FLDBDATE,
    B.FLDDEPT,
    B.FLDSTATUS,
    B.FLDSSN,
    B.FLDHOMEPHON,
    B.FLDWORKPHON,
    B.FLDID,
    B.FLDDIVISION

    OF REQEXAM,.
    B OF THE EMPLOYEE,
    C EMPLOYEE_MEMO
    WHERE A.FLDEMPLOYEE = B.FLDREC_NUM
    AND b.flduserstr = c.fldrec_num
    AND OHM_PKG. GET_LONG ('EMPLOYEE_MEMO', 'FLDDATA', C.ROWID) AS ' % CDL YES % '.
    "AND A.FLDDATEDUE > 1 January 1900"
    AND A.FLDPHYSICAL = 'COP '.
    ORDER OF B.FLDDIVISION,
    B.FLDLNAME,
    B.FLDFNAME,
    B.FLDMI,
    A.FLDDATEDUE

    -------------------------------------------------------------------------
    The error message

    Error in the command line: 26 column: 4
    Error report:
    SQL error: ORA-00904: "OHM_PKG." "" GET_LONG ": invalid identifier
    00904, 00000 - '% s: invalid identifier '.



    -------------------------------------------------------

    create or replace
    PACKAGE OHM_PKG AS

    / * TODO type (types, exceptions, methods etc.) package declarations here * /.
    getlong function (p_tname in varchar2, p_cname in varchar2, p_rowid in rowid) return varchar2;

    END OHM_PKG;

    create or replace
    PACKAGE BODY OHM_PKG AS

    getlong function (p_tname in varchar2, p_cname in varchar2, p_rowid in rowid) return varchar2 as
    whole l_cursor default dbms_sql.open_cursor;
    number of l_n;
    l_long_val varchar2 (4000);
    number of l_long_len;
    number of l_buflen: = 4000;
    l_curpos number: = 0;
    Start
    DBMS_SQL. Parse (l_cursor,
    "select" | p_cname | 'from ' | p_tname |
    ' where rowid =: x',.
    DBMS_SQL.native);
    DBMS_SQL.bind_variable (l_cursor, ': x', p_rowid);

    DBMS_SQL.define_column_long (l_cursor, 1);
    l_n: = dbms_sql.execute (l_cursor);

    If (dbms_sql.fetch_rows (l_cursor) > 0)
    then
    DBMS_SQL.column_value_long (l_cursor, 1, l_buflen, l_curpos,)
    (l_long_val, l_long_len);
    end if;
    DBMS_SQL.close_cursor (l_cursor);
    Return l_long_val;
    getLong end;

    END OHM_PKG;

    < / prev >

    Remove the '_' in the name of the function as below:

    AND OHM_PKG. GETLONG('EMPLOYEE_MEMO', 'FLDDATA', C.ROWID) AS "CDL % YES % '.

  • T/t with the WHERE clause using a list breaks

    Hello, all,.

    I have a project where I need to use a list as part of the WHERE clause for a t/t, and it is breaking.  I don't know what I'm doing wrong.

    For some pseudo-code, do I have a complete query of a database called 'people '.  A list of values for the t/t with the first query; the second query is my t/t:

    <cfquery name="getDIR" datasource="#request.THISDSN#">
        SELECT thisName dir FROM orgs WHERE thisID in (<cfqueryparam value="#form.org#" cfsqltype="cf_sql_varchar" list="yes" />)
    </cfquery>
    
    <cfquery name="people" database="people">
        SELECT colA, colB, colC, colD
        FROM people
        WHERE 1=1
            AND (
                div IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />)
                OR dir IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />)
                )
    </cfquery>
    
    
    

    I get the error message is "t/t syntax error: encountered" div IN \'thisValue\' ".»  Incorrect conditional expression, waiting for one of [as | null | between | in | comparison] condition. »

    Can support _not_ QoQ lists of WHERE clauses?

    V/r,

    ^_^

    SMH - so much... I just found.

    I forgot to give the lists in the second query bracket.


    (The pseudocode was manually typed, since my dev system is isolated from the internet, and I added the in my pseudo code when they were not in my original code.)

    * headdesk * headdesk * headdesk * headdesk *.

    V/r,

    ^_^

  • PL/SQL-function with variable number of parameters

    Hello

    I want to write an INLIKE function that combines the functions of the po and AS operator.
    I want to call it that:

    SELECT 1 in the table where INLIKE (column, Motif1, pattern2,...) with a variable count of bosses.

    Is there a possibility the java selection button (String... stringArray) to declare or to make, I have to define a function with multiple parameters and default values?

    With greetings

    Florian

    You don't need to write a function no., you can use regular expressions REGEXP_LIKE...

    for example to find all the rows that have % ED % or % LY in them...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'FRED IS SCARED' as txt from dual union all
      2             select 'EDWARD IS HAPPY' from dual union all
      3             select 'BOB AND TIM ARE ASLEEP' from dual union all
      4             select 'JIM AND SALLY DO NOT CARE' from dual)
      5  --
      6  -- END OF TEST DATA
      7  --
      8  select *
      9  from t
     10* where regexp_like(txt, '(ED|LY)')
    SQL> /
    
    TXT
    -------------------------
    FRED IS SCARED
    EDWARD IS HAPPY
    JIM AND SALLY DO NOT CARE
    
  • Passing the value of the where clause with the page

    Dear friends,

    I have a requirement like when I select a selection list value I should pass this value to sql query where clause without submitting the page

    ex I have a select like: P1_Dept guess I selects the value 10 in this

    then I have a query select * from emp where deptno =: P1_Dept.

    DB. ORACLE 11G

    APEX 4.1.1.00.23

    is this possible? can someone help me please in this topic

    Thanks and greetings

    Vballeda

    Suppose we have the selection list with the name P1_DEPT and query for report

    select * from emp where deptno = :P1_DEPT
    

    We create dynamic Action on the evolution of the P1_DEPT point. We will need two real actions:

    1-> set value action

    Set the Type - > body of the PL/SQL function

    The function of body - > return 1;

    Page item to submit-> P1_DEPT

    Change to delete-> Yes event

    Selecttion Type-> trigger element

    2. action-> Refresh

    Selecttion Type-> region

    Region-> your region of report

  • Reference SQL Loader Bind Variables in the when Clause

    Support for SQL: SQL * Loader: version 8.0.6.3.0 (don't ask, it runs on Oracle EBS 11i...)

    I have a case where my sample data looks like:
    HD00100001002
    SM00100002CHAPS   99999999999                     20120906GBP0000000000001000000000001
    and another file
    HD00100001001
    SM00100002GBP0000000000001000000000001
    Essentially, I need to apply another "IN" clause for each record of SM depends on the ack_type (char 13 on HD recording), either 1 or 2

    I tried setting up the ack_type with a variable binding but find how to reference.

    Example of control file:
    --  $Header: test.ctl
    --
    
    LOAD DATA
    REPLACE
    
    -- Record Type HD : File Header
    INTO TABLE  test_table
    WHEN rec_id_no = 'HD'
    TRAILING NULLCOLS
    (rec_no                 RECNUM,
     hdr_line               CONSTANT 'H',
     rec_id_no              POSITION(1:2)   CHAR,
     file_number            POSITION(3:5)   CHAR,
     sequence_number        POSITION(6:10)  CHAR,
     status                 POSITION(11:12) CHAR,
     ack_type               POSITION(13:13) ":ack_type",
     co_id                  POSITION(14:21) CHAR,
     dept_id                POSITION(22:24) CHAR,
     btch_no                POSITION(25:36) CHAR,
     trans_id               POSITION(37:42) CHAR)
    
    -- Record Type SM : File Summary
    INTO TABLE test_table
    WHEN rec_id_no = 'SM' and :ack_type = '1'
    TRAILING NULLCOLS
    (rec_no                 RECNUM,
     hdr_line               CONSTANT 'L',
     rec_id_no              POSITION(1:2)   CHAR,
     file_number            POSITION(3:5)   CHAR,
     sequence_number        POSITION(6:10)  CHAR,
     ccy_code               POSITION(11:13) CHAR,
     amount                 POSITION(14:26) CHAR,
     number_trans_ok        POSITION(27:40) CHAR)
    The code above does not work, it is said that: ack_type is not recognized. Is there a way to do it, given the former character of the SQL Load version?

    What is the database version 11i is running on? If 11 GR 2, this doc can help you in the use of the features that Dan mentions

    How to use the 9i or 10g features in SQL * Loader for Apps? [423035.1 ID]

    HTH
    Srini

  • make reference to a movieclip with a variable containing the name of the instance?

    There are a few occurrences of clip on the scene (not dynamically created at run time). Now, I want to do this:

    Use a variable to hold an instance name when running. then use this variable to point it to the reference clip.

    Problem: Assume that this variable is named "mc_ref". He is unable to use "_root.mc_ref" to designate the clip under the name of this mc_ref contains. It seems in this case takes flash 'mc_ref' as the instance name, and so looking for any child of that name. given that mc_ref itself is not a name, it will not work.

    is there something like MovieClipbyInstanceName function for this? Any thoughts? Thank you!

    you are confused. name of the variable and the movieclip should not be the same.

    Here are the correct ways to reference movieclips in flash:

  • Update statement with joins of tables and where Clause

    Hi, I have MS SQL background and I try to execute an update statement in Oracle with joins of tables. However, the syntax below does not work but I think it works for MS SQL.

    Basically, the base table must be attached to a master table trend with monthly snapshots, an account will be only an entry for a given date monthly. Where clause must be limited to accounts within a certain range of interest rates.

    The first approach returns command SQL ORA-00933 not correctly completed, and the second approach returns ORA-01427 row below query returns multiple rows. Can anyone help? Thanks in advance!



    1:

    Update PenaltyAll
    Set a.indicator = month (b.)
    of PenaltyAll an inner join Master b on a.acctno = b.accountnumber
    where a.monthend='01/31/2009' and b.date='12/31/2008' and b.apr < 20

    2:

    Update PenaltyAll
    adjustment indicator =
    (select to_char (b., 'MM')
    of PenaltyAll an inner join Master b on a.acctno = b.accountnumber
    "where to_char (a.monthend,'mm/dd/yyyy ') = 31 January 2009"
    (et to_char(b.date,'mm/dd/yyyy') = December 31, 2008 "
    and b.apr < 20)

    Published by: sqlrookie on August 21, 2009 07:04

    I edited my post, that was my mistake, ANC you try now?

  • Results of the query variant with unused table in the from clause

    Hi all

    I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.

    This is the provided query

    SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    cssp sales_split,
    processing_table2
    WHERE crev.order_num = '7631090072'

    Results of the above query : 344028065018.359



    SELECT

    Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    sales_split PCSS

    WHERE crev.order_num = '7631090072'

    Results of the above query : 26463697309.1046


    Someone here suggest me pls!

    924804 wrote:
    Hi all

    I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.

    This is the provided query

    SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    cssp sales_split,
    processing_table2
    WHERE crev.order_num = '7631090072'

    Results of the above query : 344028065018.359

    SELECT

    Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    sales_split PCSS

    WHERE crev.order_num = '7631090072'

    Results of the above query : 26463697309.1046

    Someone here suggest me pls!

    CARTESIAN PRODUCT of the changes result set

  • Case statement with multiple queries to the THEN clause

    Y at - it a syntax something like:

    Case

    When A = 1
    Then B: = 2 and C: = 3

    When A = 2
    Then B: = 4 and C: = 5

    Else B: = 6 and C: = 7

    End case;

    where clause can then have multiple assignments?

    Also, how to mark entries as code on this forum?

    TIA,

    Extreme Farley

    You can simplify a bit:

    SQL> declare
      2     a number := 0;
      3     b number := 0;
      4     c number := 0;
      5  begin
      6
      7     Case A
      8          WHEN 1 Then
      9            B := 2;
     10            C := 3;
     11          WHEN 2 Then
     12            B := 4;
     13            C := 5;
     14          Else
     15            B := 6;
     16            C := 7;
     17     End Case;
     18     dbms_output.put_line('A=' || a);
     19     dbms_output.put_line('B=' || b);
     20     dbms_output.put_line('C=' || c);
     21  end;
     22  /
    A=0
    B=6
    C=7
    
    PL/SQL procedure successfully completed.
    
  • PL/SQL function with update

    Hi can someone help me!

    I have this code is a function, but do not work

    CREATE or replace FUNCTION f2 (sucursala varchar,socioa number,folioa number) RETURN number IS PRAGMA AUTONOMOUS_TRANSACTION; id_mov number; ca number; sa number; int_m number; tipo varchar(400); sucu varchar(400); fech date; cursor movimientos IS select id,sucursal,cantidad,interes,movimiento,fecha from det_pzo_fijo_saldos where sucursal=sucursala and socio=socioa and folio=folioa and movimiento in ('DEPOSITO NORMAL','VENCIMIENTO CON RENOVACION DE CAPITAL E INTERES','VENCIMIENTO CON RENOVACION DE CAPITAL E INTERES MAS INCREMENTO','CANCELACION DE DEPOSITO','VENCIMIENTO SIN RENOVACION','VENCIMIENTO CON RENOVACION DE CAPITAL MAS INCREMENTO','VENCIMIENTO CON RENOVACION POR MENOS DEL CAPITAL','RETIRO DE INTERESES','VENCIMIENTO CON RENOVACION DE CAPITAL','CAPITALIZACION DE INTERESES') order by fecha,id; BEGIN open movimientos; sa:=0; fetch movimientos into id_mov,sucu,ca,int_m,tipo,fech; WHILE movimientos%found loop begin if tipo in ('DEPOSITO NORMAL', 'VENCIMIENTO CON RENOVACION DE CAPITAL E INTERES', 'VENCIMIENTO CON RENOVACION DE CAPITAL E INTERES MAS INCREMENTO') then sa:=sa+ca+int_m; else if tipo in ('CANCELACION DE DEPOSITO', 'VENCIMIENTO SIN RENOVACION', 'VENCIMIENTO CON RENOVACION DE CAPITAL MAS INCREMENTO', 'VENCIMIENTO CON RENOVACION POR MENOS DEL CAPITAL') then sa:=sa+ca; else if tipo in ('RETIRO DE INTERESES', 'VENCIMIENTO CON RENOVACION DE CAPITAL') then sa:=sa; else if tipo in ('CAPITALIZACION DE INTERESES') then if sucu in ('MATRIZ') then if (fech <= '03/10/2007') then sa:=sa+ca+int_m; end if; if (fech >= '04/10/2007') then sa:=sa; end if; end if; if sucu in ('OBRERA') then if (fech <= '18/10/2007') then sa:=sa+ca+int_m; end if; if (fech >= '19/10/2007') then sa:=sa; end if; end if; end if;  end if;  end if;  end if; update det_pzo_fijo_saldos set saldo = sa where id=id_mov; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; end; end loop; close movimientos; return sa; END; 

    In the anointing errors show don't show me anything so I don't know what the problem

    Thank you!!!

    Rewrite your function in a procedure with three inputs and one output parameter.

    Do not commit in your program, leave it to the caller (client side).

    You miss a fetch statement in your loop (put it before "END LOOP");

Maybe you are looking for