Procedure or function

Hi!
My description might not be clear at first sight, but I will try to explain:
Introduction: We have a master flight information table that stores information about each flight including the flight date, i.e.
Flight master table
Flight_no From Leaving To Arrival Date
UA234 JFK 10:40 LAX 15:50 1-JAN-07
UA234 JFK 10:40 LAX 15:50 2-JAN-07
There are about 700 flights x 365 (daily flights) entries = 255.500 rows. We want to improve the overall performance of our database with a PL/SQL-procedure or function that should do the following:
Instead of having the flight date entered 365 times for each flight, have the procedure or function calculate and show the flight dates according to the flight frequency for each month, i.e.
Flight master table new
Flight_no From Leaving To Arrival January February
UA234 JFK 10:40 LAX 15:50 12345671234567….. .....
UA234 JFK 10:40 LAX 15:50 12345671234567….. .....
If not a daily flight, then
UA786 IAD 12:10 SFO 18:05 12345--12345-- ......
Frequency: 1 = Monday, 2 = Tuesday, 3 = Wednesday ….
(12345671234567….. means for all days in a month)
So, we would have only 700 records to search through.
Thanks for any suggestions!

This looks like the type of table which data is entered once and retrieved many times. And that's why I'd stick with the current implementation. It seems like you are introducing all kind of complexities only for storage reasons. Performance is generally better when not having to calculate each date by decoding a '12345--' field and making up rows for a larger period.
>So, we would have only 700 records to search through.
Alternative idea: why not have a 700 record flight table and a separate 255.500 record flight_times table
flight: (no, from, to)
flight_times (flight_no, departure_time, arrival_time)
Regards,
Rob.

Similar Messages

  • How to find out list of procedures and functions inside a package

    How I can find out the list of Procedures and Functions inside a Package.

    Look at ALL_PROCEDURES and ALL_ARGUMENTS.

  • How to Call Procedure or Function

    Hi,
    How to call a procedure or function in apex, Please let me know
    Thanks
    Sudhir

    Hi,
    This post might help
    Re: How to Call procedure In Processes
    Regards,
    Jari

  • How to write procedure or function or any sql statement for requirement

    Hi,
    i have a table named letter,it contains 2 columns named as letter_id and letter_content.
    select * from letter;
    letter_id letter_content
    103 Dear MFR
    103 This is in regards to the attached DM List
    103 Please Credit us after reviewing it.
    103 Thanks
    103 Regards
    103 xxxx
    108 Dear customer
    108 This is to inform that ur DM List is as follows
    108 Credit us according to the Dm after reviewing it.
    108 Thanks
    108 Regards
    108 xxxx
    now my requirement is,i need send a parameter as letter_id to a procedure or function in pl/sql in oracle,the output should be as follows:
    if we will pass parameter(letter_id) = 103 then it displays as follows:
    Dear MFR
    This is in regards to the attached DM List.Please Credit us after reviewing it.
    Thanks
    Regards,
    XXXXX.
    if we will pass parameter(letter_id) = 108 then it should displays as follows:
    Dear customer,
    This is to inform that ur DM List is as follows. Credit us according to the Dm after reviewing it.
    Thanks
    Regards,
    XXXXX.
    ---------------------------------------------------------------------------------------------------------

    i am really appriciate ur help.
    thank u so much for ur suggestions.
    when i am uning line_seq its giving an error
    ORA-00904: "LINE_SEQ": invalid identifier
    so,in my table i had created a sequense named content_seq.
    select * from letter;
    content_seq letter_id letter_content
    1 103 Dear MFR
    2 103 This is in regards to the attached DM List
    3 103 Please Credit us after reviewing it.
    4 103 Thanks
    5 103 Regards
    6 103 xxxx
    7 108 Dear customer
    8 108 This is to inform that ur DM List is as follows
    9 108 Credit us according to the Dm after reviewing it.
    10 108 Thanks
    11 108 Regards
    12 108 xxxx
    then i had used ur code as follows:
    select linefrom ( select content_seq , letter_content || case content_seq when 2 then ' ' || lead(letter_content) over (partition by letter_id order by content_seq) end as line from letter where letter_id = 103 )where content_seq <> 3;
    LETTER_CONTENT
    Dear MFR
    this is in regards to the attached DM List Please credit us after reviewing it
    thanks
    Regards
    EXP
    but when i take letter_id = 108 the format is comming different.it was unable to combine 2lines.
    Message was edited by:
    user579585
    Message was edited by:
    user579585

  • How to reconcile procedure or function in a mapping using OMB Plus?

    HI,
    Could any one please explain, how to reconcile a procedure or function used in a mapping?
    Thank you,
    Regards,
    Gowtham Sen.

    Hi,
    You can only reconcile Inbound (from Procedure to the mapping) :
    OMBRECONCILE PROCEDURE \
    '/[Project_name]/[Module_name]/[Procedure_name]
    TO MAPPING '[Mapping_name]' \
    OPERATOR '[for example name of a Post-Mapping Process in the mapping]' \
    USE (RECONCILE_STRATEGY 'REPLACE', MATCHING_STRATEGY 'MATCH_BY_OBJECT_ID')
    Hope that will help.
    Best Regards
    Samy

  • Use of Procedure and Functions in ADF BC

    Hi,
    In ADF 11g
    1. can I use oracle function and procedures ( having in and OUT parameters) to expose as service interface
    2. if yes , How can this be done. and what are the allowed data types as input to procedure/function and can be returned by procedure/function
    3. How the transaction control will be achieved using ADF BC service interface.
    E.g. one ADF BC creates orders in order details and second creates Order lines in Order lines table. Now if order is created successfully but line creation fails then I want order to be rolled back also.
    Thanks.

    google it out.
    How to get two out param which is used in Procedure
    http://sameh-nassar.blogspot.in/2010/01/create-plsql-function-and-call-it-from.html
    http://adf-tools.blogspot.in/2010/09/adf-function-call-from-el-statement-in.html
    http://adf-tools.blogspot.in/2010/03/adf-plsql-procedure-or-function-call.html
    http://adfhowto.blogspot.in/2010/11/call-db-procedure-or-function-from-adf.html
    Re: use of Procedure and Functions in ADF BC

  • How can I catch a resultset thrown out by PL/SQL procedure or function.

    hi,
    I want to write a program in java which receives a resultset
    from PL/SQL , how can I do that.
    I don't want to create the resultset by passing a simple sql
    statement, I want the sql statement to be executed in the
    procedure or function,
    which in turn returns a PL/SQL table of records, or refcursor,
    and capture it in the resultset.

    Here's a quick note on how I do it:
    1. RETURN a REF CURSOR from your PL/SQL function.
    2. In your Java program, you declare the return type from the
    Statement as OracleTypes.CURSOR.
    /* Prepare your PL/SQL function call here */
    CallableStatement mystatement = myconnection.prepareCall
    ( "BEGIN ? := myfunction( p_param => ? ); END;" );
    /* Register the Oracle REF CURSOR as the return type */
    mystatement.registerOutParameter(1, OracleTypes.CURSOR);
    /* Set any additional input parameters to your function */
    mystatement.setString(2, "Param value");
    3. When you fetch the cursor from your Statement, do getObject
    () and then cast the Object as a ResultSet e.g.:
    mystatement.execute);
    ResultSet rs = (ResultSet) mystatement.getObject(1);
    /* Now you can iterate through the ResultSet in the same way as
    for any other JDBC ResultSet */
    while (rset.next())
    /* Fetch the values from your REF CURSOR here */
    mystatement.close();
    There may be better ways to do this, but it works for me.
    Regards,
    Chris I've put in a few more details above. Sorry I can't copy in a
    whole chunk of code for you, but this should be enough to get
    you started. I would recommend the Wrox Press book on
    application programming with Oracle 8i, as it includes lots of
    examples of many different tools for Oracle 8i e.g. JDBC, EJB,
    BC4J, Portal, XML etc.
    Good luck,
    Chris

  • Error while using DB Adapter in BPEL[Calling a procedure or function]

    Hi
    I am getting Error while executing the BPEL Process.
    1) I created a BPEL Process which uses a DB Adapter. I am using call a procedure or function. My Procedure is shown below. It takes a string a s input parameter and executes that string. I have used an assign activity to assign the input string.
    Procedure
    create or replace
    PROCEDURE SP_QUERY(s_string in varchar2)
    AS
    l_sql_stmt varchar2(1000);
    BEGIN
    l_sql_stmt := s_string;
    -- dbms_output.put_line( l_sql_stmt );
    EXECute immediate l_sql_stmt;
    commit;
    dbms_output.put_line('Executed' );
    -- if SQLCODE = 0 then
    --retCodeString := 'OK';
    --end if;
    END;
    I gave input string as "select * from tab", I have also tried a insert statement to a table in which its present in this database. But i am getting the following error.
    <3 Jun, 2013 9:42:25 AM IST> <Error> <oracle.webservices.service> <OWS-04115>
    Whats the Issue? Is the issue with the procedure or the BPEL process? Please help me out. I am stuck in this

    Hi,
    According to your message you have selected your procedure, but looks like the procedure is not having any reply or response parameter with it.
    Have you executed the procedure separately from SQL editor and see whether you are able to get the response or not ?
    If you get response, then how many columns are you getting ?
    Check the column names are matching with the schema file generated by adapter and see whether those column names are available as elements in .xsd file.
    Example provided below..
    In the below link, check the section "9.7 Stored Procedure and Function Support"
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_db.htm#CHDFBBCD
    Thanks,
    Vijay

  • Call a PL/SQL procedure or function from applet

    Could anyone please let me know how I could call a PL/SQL procedure
    or function from a JDBC method from applet with Internet Explorer?

    It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
    If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
    In either case, you can not go back to the PLSQL routine.
    In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine.

  • Are the Pl/sql procedure and function atomic by themself

    i want to ask a question does oracle pl/sql procedure and function support Atomicity for the database by themself , or they became atomic incase we call them using begin -- end;

    You appear to be discussing transaction scope which is completely independent of PL/SQL blocks like procedures or how you call procedures. It's all in where commits (or rollbacks) are issued.
    If you have a procedure like this
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;where the first statement succeeds and the second statement fails as a result of a duplicate key, there will still be a Foo row in the table but the procedure will have thrown an exception. The caller of the procedure may choose to commit or rollback the change-- that will determine whether the first statement's results are made permanent. If you have a procedure like this,
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      commit;
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;the commit will make the first insert permanent regardless of whether the second statement fails no matter what the calling code does (that's one reason that putting commits in stored procedures is generally a bad idea-- the caller is in a much better position to know what other uncommitted work has been done and whether it is safe to commit.
    Justin

  • Can we call a procedure within function?

    Can we call a procedure in function?
    If yes, then please explain with example.
    Thanks
    Aman

    Why don't you try it?
    SQL> set serveroutput on
    SQL> declare
      2   procedure p1 (
      3    i1 in out number
      4   )
      5   as
      6   begin
      7    i1 := 200;
      8   end p1;
      9   function f1
    10   return number
    11   is
    12    l1 number;
    13   begin
    14    p1(l1);
    15    return l1;
    16   end f1;
    17  begin
    18   dbms_output.put_line(f1);
    19  end;
    20  /
    200
    PL/SQL procedure successfully completed.
    SQL> set serveroutput off

  • How to know (package , procedures or functions) name for current sessions

    Hi all
    I'm DBA and i want to find way to get object name whatever (package , procedures or functions) for current running statement in active session.
    To clarify when i open session browser from toad i can see active sessions and see current statement for every session but without the name of the object.
    Is there any way to know this point.
    thanks in advance

    select *
      from dba_objects
    where object_id in (select nvl(t.PLSQL_ENTRY_OBJECT_ID,-1)
                           from v$session t
                          where sid = 452)
    Ramin Hashimzade

  • Java Stored Procedure via Function Give 0RA 600 from SQL Workshop and App

    Hi,
    Anyone experienced stored procedures or functions failing when called from APEX app or SQL Workshop ( ora 600 ) yet they work fine when called from SQLPlus?
    Sqlplus connected as my apex workspace schema owner:
    select net_services.test_db_connection_via_ldap(
    'APEXPRD1', 'test1', 'test1', null ) as result from dual;
    RESULT
    The database connection attempt was SUCCESSFUL
    From Apex Sql Worshop:
    select net_services.test_db_connection_via_ldap(
    'APEXPRD1', 'test1', 'test1', null ) as result from dual;
    ORA-00600: internal error code, arguments: [16371], [0x434B08150], [0], [], [], [], [], [], [], [], [], []
    NOTE: Same result when run in response to button push on page in application.
    Apex Version: 3.2.1.00.10
    Oracle Version: 11.1.0.7.0
    NOTE: I am using the embedded plsql gateway; was going to try NOT using it to see if it was shared server related (seemed to be from trc files)
    Any ideas?
    Since the code works from sqlplus, I know that it's good: Here some snippets
    -- ========================================================================================
    public class NetServices extends Object {
    public static String doTestDbConnectionViaLdap
    String piDbConnUrl,
    String piUserName,
    String piUserPassword
         String vResult = null;
    try
         Connection conn = null;
         OracleDataSource ods = new OracleDataSource();
         ods.setUser( piUserName );
         ods.setPassword( piUserPassword );
         ods.setURL( piDbConnUrl );
         conn = ods.getConnection();
         conn.close();
         vResult = "The database connection attempt was SUCCESSFUL";
    } catch ( SQLException e )
         int vErrCode = e.getErrorCode();
         String vErrMsg = e.toString();
              if ( vErrCode == 1017 ) {
              vResult = "The database connection attempt FAILED! Incorrect Username or Password";
         } else if ( vErrCode == 17433 ) { // Null Username or Password
              vResult = "The database connection attempt FAILED! You must provide both a Username and a Password";
         } else if ( vErrCode == 17002 ) {
              vResult = "The database connection attempt FAILED! Net Service Name was Not Found";
         } else if ( vErrCode == 17067 ) { // NULL Net Service Name
              vResult = "The database connection attempt FAILED! You must provide a Net Service Name";
         } else {
              vResult = "The database connection attempt FAILED! Error " + vErrCode;
    return vResult;
    } // method: doTestDbConnectionViaLdap
    -- ========================================================================================
    function do_test_db_connection_via_ldap
    pi_db_conn_url IN VARCHAR2,
    pi_user_name IN VARCHAR2,
    pi_user_password IN VARCHAR2
    return VARCHAR2
    is -- PRIVATE to the net_services package
    language java -- NOTE: See cr_java_class_NetServices.sql for actual java implementation
    name 'NetServices.doTestDbConnectionViaLdap
    ( java.lang.String, java.lang.String, java.lang.String ) return java.lang.String ';
    -- ========================================================================================
    function test_db_connection_via_ldap
    pi_net_service_name IN VARCHAR2,
    pi_user_name IN VARCHAR2,
    pi_user_password IN VARCHAR2,
    pi_search_base IN VARCHAR2
    return VARCHAR2
    is -- PUBLIC procedure
    v_url      VARCHAR2(256);
    begin
    g_err_source := 'NET_SERVICES.test_db_connection_via_ldap';
    g_err_action := 'build_jdbc_conn_url_using_oid';
    /*     NOTE: We don't want to assert the parameters because we don't want to raise
    an exception;
    -- Get the jdbc connection url that uses oid info
    v_url := build_jdbc_conn_url_using_oid( pi_net_service_name, pi_search_base );
    return( do_test_db_connection_via_ldap( v_url, pi_user_name, pi_user_password ) );
    end test_db_connection_via_ldap;
    -- ========================================================================================
    Thanks in advance for your consideration.
    Troy

    Troy:
    You could be right in your guess that the error is related to MTS. Search Metalink for '16371'. Why not switch your APEX app to use OHS and test whether the error persists. ?
    varad

  • Procedure and Functions from ADF View Layer

    Hi,
    Before i ask my question ,I would like to mention that I have done lot of googling on this topic before asking this question.
    http://adfhowto.blogspot.in/2010/11/call-db-procedure-or-function-from-adf.html
    http://adf-tools.blogspot.ca/2010/03/adf-plsql-procedure-or-function-call.html
    Lot of threads on otn forum too on this topic.
    I m pretty new to ADf too.
    Now most of our logic is in procedures and functions ,so on various events on form(view layer) I need to call procedure and function and then return values back to value layer too.
    Now the approach mentioned in the link above is good whats best approach to return out parameters to view layer considering i will be using either the DbCall class for all calls to procedures and functions
    I am thinking of this approach to Create a view with static fields,and in Model layer set values for these fields and access them in view layer or binding view controls to these fields.
    From View layer i will call the methods in AppmodImpl which will be calling procedure( methods will be exposed as Client Interface)
    Also in few articles i came across generic CallStoredProcedure and CallStoredFunctions.
    But my main concern is how to share out parameters with view layer....can anyone give link of showing application of it on view layer.
    Regards,

    From your subject. am stating that, dont do all those stuff in backing bean. backing bean is 1:1 mapping with your .jpsx or .jsff .
    best approach would be call those things your Application Module(model layer) exposed it. access the method over your pagedef. well said by ram.

  • Without calling stored procedure or functions from database

    Hi,
    I am using Jdeveloper 11.1.1.5.0.
    =>How to do PL/SQL procedures and functions in ADF without calling stored procedure or function from DB?

    S, PL/SQL procedures and functions are done in Application Module class or in managed bean..By calling the stored procedures or functions from DB.
    But I am asking how to do if DB doesn't have any procedures,triggers and functions.

  • How can I use the procedures and functions in my library

    hello, all
    I have a pl/sql library MYLIB.pld, MYLIB.pll and MYLIB.plx.
    How can I invoke procedures and functions there in JDeveloper?
    Thanks.
    Damon

    I am indeed using ADF BC to re-develop the oracle application.
    Here is my situation:
    We have an oracle form application.
    Our objective is to try to re-use the existing sources in the form application as much as possible:
    1. tons of procedures and functions in a pl/sql library(a file with extension name portfolioLib.pll or portfolioLib.plx);
    2. tons of form-level triggers, data-block triggers and item-triggers;
    3. tons of database stored procedures and triggers;
    After doing a research on JDeveloper, we decide to use ADF Swing+ADF BC to re-develop the application.
    My opinion for the above three kinds of sources in our form application is:
    for 1: we try to move most of procedures and functions into database(except Form build-in);
    for 2: we try to wrap those triggers in a SQLJ class;
    for 3: we try to call database procedures and functions with PreparedStatment or CallableStatement;
    I just do a test on a post-query trigger on a data-block:
    I created a sqlj file, named testSQLJ.sqlj in the test.view package;
    I tried to call it in createInstanceFromResultSet of testDeptVOImpl.java which is test.model package,
    I was told that testSQLJ cannot be found there. why?
    How can I call some classes from test.view package in some classes of test.model?
    I read some documents about how to deal with post-query trigger in JDeveloper: create a view with SQL statement, but it seems that it does not support pl/sql statement there.
    Can you give me some opinion about the above stuff?
    I really appreciate your help.
    Damon

Maybe you are looking for

  • Can I make a remix from several different songs in itunes?

    I'm looking to pick and choose sections of several songs and put them all together for a family presentation/fun skit. Since all of the songs I want to use are in itunes I was hoping that there was a simple way of doing this in itunes then adding it

  • ADF independent transactions

    Hi all, I'm trying to implement independent transactions in JSF/ADF. At the next lines I'll try to explain the process that I have followed: - First of all we know there are two ways to obtain independent transactions (e.g. different executions of th

  • How to install E-business suite for easy and simple?

    Please help me. I installed oracle application 11i,but i don,t use it. when i create a new user or modify a user,then login in system with this user name,but it is failed.the error message is : ORA-01403:not found data. ORA-06510: ORA-01403: Traslati

  • How can I get the number of rows in my sql result, without a loop?

    Hello, I've a problem, I would like to get the number of rows in my sql result without make a loop like : while (rs.next()){ int number = rs.getRow(); Is there any method to do this, on the first element? Thx, STeF

  • I tunes is not recognizing the iphone

    i have tried to update my iphone 4 last night...but there was an error and not my iphone is stuck on the connect to itunes logo... After connecting, itunes is not showing the iphone...