Dynamic object called in Procedure

Hi ,
Let me first explain the requirment of my prj.its telecom based prj.There are various types of network equipment.So i have created the object for those equipment.
for ex
CREATE TYPE 16x AS OBJECT (...._);
CREATE TYPE 4x AS OBJECT (...._);
Now I have to write a procedure in which we just pass the eqipment name .
for ex 16x
Now as soon as I pass the eqipment name the procedure should direclty select the varaible of object 16x.
SO how is possible to select the variable along with associated objectstype of the equiment at runtime only.
Hope someone can answer my question.
Thanks in advance.

.So i have created the object for those equipment.Why are you using objects? The Oracle o-o implementation is not complete, and (in my opinion) not very useful outside of some rather unusual scenarions. Find out more.
Anyway, let's assume your motives are good. It's also not clear precisely what you have done, so it's difficult to be sure what your problem is. What I would do woyuld be to create a master type of NETWORK_EQPT and then extend that to specific types - 16x, 4x. You can then write a function to instantiate a NETWORK_EQPT object which will figure it all out and return the appropriate subtype....
SQL> create type network_eqpt as object (type varchar2(3), name varchar2(30))
  2  not final
  3  /
Type created.
SQL> create type net_16X under network_eqpt (capacity number)
  2  /
Type created.
SQL> create type net_4X under network_eqpt (start_date date)
  2  /
Type created.
SQL> create or replace function new_nw
  2      (p_type varchar2, p_name varchar2
  3          , p_capacity number := null, p_start date := null)
  4  return network_eqpt
  5  is
  6      return_value network_eqpt;
  7  begin
  8      if p_type = '16X' then
  9          return_value := net_16X(p_type,p_name, p_capacity);
10      elsif  p_type = '4X' then
11         return_value := net_4X(p_type,p_name, p_start);
12      else
13         return_value := network_eqpt(p_type,p_name);
14      end if;
15      return return_value;
16  end new_nw;
17  /
Function created.
SQL> select new_nw('APC', 'Not a network') from dual
  2  /
NEW_NW('APC','NOTANETWORK')(TYPE, NAME)
NETWORK_EQPT('APC', 'Not a network')
SQL> select new_nw('16X', 'Recognised type', 89) from dual
  2  /
NEW_NW('16X','RECOGNISEDTYPE',89)(TYPE, NAME)
NET_16X('16X', 'Recognised type', 89)
SQL> Be aware that the above is just a sample of what can be done rather than a indication of the correct way to program it.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/

Similar Messages

  • URL object calling stored procedure

    I want to call a dynamic web page (stored procedure) as a portlet. Is the best way to do this to create a URL object (in Applications) that points to the stored procedure? I have been trying this, but Portal can't find the page. The URL is valid (probably has to do with PL/SQL Gateway). What is the process for calling a stored procedure as a portlet? I don't want a Portal form created for this. I don't want any user interface template or other overhead in this portlet. The stored procedure needs full control of the content.
    null

    Hi James,
    You can try creating a dynamic page (in Applications). In your dynamic page, you can take out all the HTML codes and simply put the package/prodecure name in there. Then you can publish that Dynamic Page as a portlet and include that in your Portal page.
    Hope this helps.
    Regards,
    Jatinder

  • Creating parameters dynamically and calling a procedure but strange issue

    Okay I have the following program that is calling a procedure(data_compare_utility)[pasted below] and data_compare_table_setup table definition and data(isert scripts) are pasted below :
    DECLARE
    --FP_OLD_TABLE VARCHAR2(200);
    --FP_NEW_TABLE VARCHAR2(200);
    --FP_DATA_COMPARE_ID NUMBER(10) := 1;
    --FP_RESTRICTION_CLAUSE VARCHAR2(500) := 'WHERE W_INSERT_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'') OR W_UPDATE_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'')';
    --FP_RESTRICTION_CLAUSE_4_INS VARCHAR2(500) := 'WHERE W_INSERT_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''') OR W_UPDATE_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''')';
    cursor c_data_compare_table_setup
    is
    select table_name, old_schema_name, new_schema_name, data_compare_id, restriction_clause, restriction_clause_ins from DATA_COMPARE_TABLE_SETUP;
    r_of_data_compare_table_setup c_data_compare_table_setup%rowtype;
    Lv_args_4_data_compare_utility varchar2(500);
    BEGIN
    --FP_OLD_TABLE := 'BIAPPS_11.RAHUL_EMPLOYEES';
    --FP_NEW_TABLE := 'RAHULKALRA.RAHUL_EMPLOYEES';
    open c_data_compare_table_setup;
    Loop
    fetch c_data_compare_table_setup into r_of_data_compare_table_setup;
    exit when c_data_compare_table_setup%NOTFOUND;
    --exec RAHULKALRA.P_COMPARE_DATA_UTILITY
    Lv_args_4_data_compare_utility := ''''||r_of_data_compare_table_setup.OLD_SCHEMA_NAME||'.'||r_of_data_compare_table_setup.TABLE_NAME||''','''||r_of_data_compare_table_setup.NEW_SCHEMA_NAME||'.'||r_of_data_compare_table_setup.TABLE_NAME||''','||r_of_data_compare_table_setup.DATA_COMPARE_ID||','''||r_of_data_compare_table_setup.RESTRICTION_CLAUSE||''','''||r_of_data_compare_table_setup.RESTRICTION_CLAUSE_INS||'''';
    P_COMPARE_DATA_UTILITY(Lv_args_4_data_compare_utility);
    commit;
    End Loop;
    dbms_output.put_line('rahul');
    dbms_output.put_line(''''||r_of_data_compare_table_setup.OLD_SCHEMA_NAME||'.'||r_of_data_compare_table_setup.TABLE_NAME||''','''||r_of_data_compare_table_setup.NEW_SCHEMA_NAME||'.'||r_of_data_compare_table_setup.TABLE_NAME||''','||r_of_data_compare_table_setup.DATA_COMPARE_ID||','''||r_of_data_compare_table_setup.RESTRICTION_CLAUSE||''','''||r_of_data_compare_table_setup.RESTRICTION_CLAUSE_INS||'''');
    --P_COMPARE_DATA_UTILITY('BIAPPS_11.RAHUL_EMPLOYEES','RAHULKALRA.RAHUL_EMPLOYEES',1,'WHERE W_INSERT_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'') OR W_UPDATE_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'')','WHERE W_INSERT_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''') OR W_UPDATE_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''')');
    --P_COMPARE_DATA_UTILITY('BIAPPS_11.RAHUL_EMPLOYEES','RAHULKALRA.RAHUL_EMPLOYEES',1,'WHERE W_INSERT_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'') OR W_UPDATE_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'')','WHERE W_INSERT_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''') OR W_UPDATE_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''')');
    close c_data_compare_table_setup;
    END;
    Procedure : compare_data_utility:
    CREATE OR REPLACE procedure RAHULKALRA.p_compare_data_utility(fp1_old_table in varchar2, fp2_new_table in varchar2, fp3_data_compare_id in number, fp4_restriction_clause in varchar2, fp5_recrtiction_clause_4_ins in varchar2)
    as
    Lv_common_column_names varchar2(2000);
    Lv_primary_column_name varchar2(50);
    Lv_insert_data_compare_log varchar2(2000);
    --Lv_counter number(10);
    Lv_row_id_for_data_compare_log number(10);
    Lv_old_table_record_count number(10);
    Lv_old_table_rec_cnt_query varchar2(200);
    Lv_new_table_record_count number(10);
    Lv_new_table_rec_cnt_query varchar2(200);
    begin
    select max(row_id) into Lv_row_id_for_data_compare_log from data_compare_log;
    Lv_old_table_rec_cnt_query := 'Select count(*) from '||fp1_old_table||' '||fp4_restriction_clause;
    dbms_output.put_line(Lv_old_table_rec_cnt_query);
    execute immediate Lv_old_table_rec_cnt_query into Lv_old_table_record_count;
    Lv_new_table_rec_cnt_query := 'Select count(*) from '||fp2_new_table||' '||fp4_restriction_clause;
    execute immediate Lv_new_table_rec_cnt_query into Lv_new_table_record_count;
    dbms_output.put_line(fp5_recrtiction_clause_4_ins);
    if (Lv_row_id_for_data_compare_log is null)
    then
    Lv_row_id_for_data_compare_log := 1;
    else
    Lv_row_id_for_data_compare_log := Lv_row_id_for_data_compare_log + 1;
    end if;
    Lv_insert_data_compare_log := 'insert into data_compare_log values('||Lv_row_id_for_data_compare_log||',''comparing data for '||fp1_old_table||' and '||fp2_new_table||''','''||fp1_old_table||''','''||fp2_new_table||''',TO_DATE('''||to_char(sysdate,'DD-MON-YY HH24:MI:SS')||''',''DD-MON-YY HH24:MI:SS''),'||fp3_data_compare_id||','||Lv_old_table_record_count||','''||'Select count(*) from '||fp1_old_table||' '||fp5_recrtiction_clause_4_ins||''','||Lv_new_table_record_count||','''||'Select count(*) from '||fp2_new_table||' '||fp5_recrtiction_clause_4_ins||''')';
    dbms_output.put_line(Lv_insert_data_compare_log);
    execute immediate Lv_insert_data_compare_log;
    commit;
    -- tested : dbms_output.put_line(Lv_insert_data_compare_log);
    Lv_common_column_names := f_fetch_common_column_names(fp1_old_table,fp2_new_table,fp3_data_compare_id);
    -- tested : dbms_output.put_line(Lv_common_column_names);
    Lv_primary_column_name := f_extract_pkey_column_names(fp1_old_table, fp2_new_table);
    dbms_output.put_line(Lv_primary_column_name);
    p_compare_data(fp1_old_table,fp2_new_table,Lv_common_column_names,Lv_primary_column_name,fp4_restriction_clause,fp3_data_compare_id);
    end;
    CREATE TABLE RAHULKALRA.DATA_COMPARE_TABLE_SETUP
    TABLE_ID NUMBER(10),
    TABLE_NAME VARCHAR2(100 BYTE),
    OLD_SCHEMA_NAME VARCHAR2(100 BYTE),
    NEW_SCHEMA_NAME VARCHAR2(100 BYTE),
    RESTRICTION_CLAUSE VARCHAR2(500 BYTE),
    RESTRICTION_CLAUSE_INS VARCHAR2(500 BYTE),
    DATA_COMPARE_ID NUMBER(10)
    Insert into DATA_COMPARE_TABLE_SETUP
    (TABLE_NAME, OLD_SCHEMA_NAME, NEW_SCHEMA_NAME, DATA_COMPARE_ID, RESTRICTION_CLAUSE, RESTRICTION_CLAUSE_INS)
    Values
    ('W_CHNL_TYPE_D', 'BIAPPS_11', 'RAHULKALRA', 1, 'WHERE W_INSERT_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''') OR W_UPDATE_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''')', 'WHERE W_INSERT_DT >= TO_DATE(''''''''01/JAN/2012'''''''',''''''''DD/MON/YYYY'''''''') OR W_UPDATE_DT >= TO_DATE(''''''''01/JAN/2012'''''''',''''''''DD/MON/YYYY'''''''')');
    Insert into DATA_COMPARE_TABLE_SETUP
    (TABLE_NAME, OLD_SCHEMA_NAME, NEW_SCHEMA_NAME, DATA_COMPARE_ID, RESTRICTION_CLAUSE, RESTRICTION_CLAUSE_INS)
    Values
    ('RAHUL_EMPLOYEES', 'BIAPPS_11', 'RAHULKALRA', 1, 'WHERE W_INSERT_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''') OR W_UPDATE_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''')', 'WHERE W_INSERT_DT >= TO_DATE(''''''''01/JAN/2012'''''''',''''''''DD/MON/YYYY'''''''') OR W_UPDATE_DT >= TO_DATE(''''''''01/JAN/2012'''''''',''''''''DD/MON/YYYY'''''''')');
    I am facing the following error for this command when I call P_compre_data_utility procedure from my anonymous block:
    P_COMPARE_DATA_UTILITY(Lv_args_4_data_compare_utility); -- the error is pasted below
    if I do a dbms_output.put_line(Lv_args_4_data_compare_utility) and then copy paste its output and call P_COMPARE_DATA_UTILITY, the procedure is getting executed, here is that command :
    P_COMPARE_DATA_UTILITY('BIAPPS_11.RAHUL_EMPLOYEES','RAHULKALRA.RAHUL_EMPLOYEES',1,'WHERE W_INSERT_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'') OR W_UPDATE_DT >= TO_DATE(''01/JAN/2012'',''DD/MON/YYYY'')','WHERE W_INSERT_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''') OR W_UPDATE_DT >= TO_DATE(''''01/JAN/2012'''',''''DD/MON/YYYY'''')');
    Error:
    ORA-06550: line 27, column 7:
    PLS-00306: wrong number or types of arguments in call to 'P_COMPARE_DATA_UTILITY'
    ORA-06550: line 27, column 7:
    PL/SQL: Statement ignored
    Question : just want to know whats wrong with : P_COMPARE_DATA_UTILITY(Lv_args_4_data_compare_utility);
    please help me.
    Regards
    Rahul

    Mac_Freak_Rahul wrote:
    Hi All,
    I am really sorry, my head is so aching since I am not a regular plsql coder and to save my life I need to write this code for data comparison between 2 tables .. further sorry about calling p_data_compare utility stupidly : P_COMPARE_DATA_UTILITY(Lv_args_4_data_compare_utility);
    I am calling it now using :
    execute immediate 'exec P_COMPARE_DATA_UTILITY('||Lv_args_4_data_compare_utility||')';If you are sure the call works then, exec would not work since it is a SQLPLUS command.
    try
    execute immediate 'BEGIN P_COMPARE_DATA_UTILITY(''||Lv_args_4_data_compare_utility||''); END;';
    PS: I can manually give table names to my utility , just need 60 tables to compare but would be great if I can work it out this eay.
    2) I can sound very stupid since my head is aching I am not a regular plsql coder but from now on I would be one, please helpJust for your sake, to Compare 60 tables (Supposing you just want to verify count of records), you are writing an entire procedure; You might have completed this activity by now doing the manual way. By taking this way, you are investing time to generate a correct code (as you just mentioned not being a regular plsql developer) you are stuck with some un-identifiable issues.
    As an alternate way, I would suggest you to export the data, after ordering, into a spreadsheet and then validate. Also, since it looks like you are comparing the data in the same database between schemas, you can also use the SQL Navigators Data Compare utility and there are many more readily available in market.
    I would wish you the best if you still prefer taking the approach.

  • Dynamic object call

    hi i have following code:
         switch (type) {
                   default:
                   case 1:
                        objSquare sq = new objSquare(positionX, positionY, positionX1,
                                  positionY1);
                        sq.color = color;
                        sq.paint(g);
                        break;
                   case 2:
                        objArc ac = new objArc(positionX, positionY, positionX1,
                                  positionY1);
                        ac.color = color;
                        ac.paint(g);
                        break;
    }it is possible to create Java object dynamicaly? So there will be no switch, but i will load object name to call from database...for example, this "objSquare sq = new objSquare" will be called depending on object requested, so i dont need many switch cases, just one object call..
    more details:
    i have DB table with:
    id object_id object_name etc....
    and i want to load object in java that corresponds with object_name variable i will get from DB...it is possible?

    You can use reflection for this, or use a map of names to factory pattern. I'd go with a factory, as it's not as open to insecurities. So have a HashMap<String, Class> or HashMap<String, Factory> where Factory is an interface with an appropriate method to create your objects, and Class is java.lang.Class and you create your objects using the newInstance method.

  • Calling a procedure from Dynamic Page

    I am trying to call a procedure from a dynamic page. The procedure displays multi records from a table. I have created a procedure:
    PROCEDURE process_student_request( p_primary_request in wwv_utl_api_types.vc_arr,
    p_alternate_request in wwv_utl_api_types.vc_arr,
    p_action in varchar2,
    l_status in out varchar2);
    When I hit the submit button on the dynamic page it does not execute the procedure and tries to open a new page. How do I get this to work?
    Here is the text of the page:
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <FORM action="portal30.star_portal.process_student_requests" method="post">
    <TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" class="RegionBorder">
    <TR>
    <TD valign="top" align="left" width="40%"><FONT class="PortletText1">
    <ORACLE>declare
    row_num number := 1;
    hold_row_num number;
    hold_class_cd stars3.req.class_cd%TYPE;
    begin
    for c1 in (select A.start_yy, A.school, A.student_id, A.class_cd, B.name from stars3.course B, stars3.req A
    where A.student_id = portal30.star_portal.get_session_variable('STUDENT_ID') and A.start_yy = '01' and
    A.alternate_no = '0' and
    B.start_yy = A.start_yy and
    B.school = A.school and
    B.class_cd = A.class_cd)
    loop
    hold_class_cd := c1.class_cd;
    htp.p(lpad(to_char(row_num),2,'0'));
    htp.p('<select name="p_primary_request">');
    htp.p('<option value="' || c1.class_cd|| '">' || c1.name || '</option>');
    row_num := row_num + 1;
    htp.p('<BR>');
    end loop;
    htp.p('<input type="submit" name="p_action">');
    end;
    </ORACLE>
    </BODY>
    </FORM>
    </TD>
    </TR>
    </TABLE>
    </HTML>

    Bob,
    You have variables in your procedure like l_status, p_alternate_status which you do not have in the form. Are these IN or OUT variables ?
    If these are IN variables, this proc will not work because you do not have any variable in the form. So from where does it get the values? There is not any default declared too. You have to explicitly define IN or OUT variables.
    Have you also given execute permission to public ?

  • Calling Stored Procedure in Table Object

    Dear All
    i can run a Stored Procedure in App Module Level.
    is there any way to call this procedure in object level or call it from appmodule level ?
    Many Thanks
    Edited by: Oracle ITself on Mar 22, 2010 12:08 PM

    You are still working on this.
    Please see sample codes ( extracts from my project is working in prod) and you need to create your jdbc url or jdbc datasource in your AppleModule. I am using 10.1.3.4 , I hope this will help you.
    1. jspx.
    <af:table value="#{bindings.yourView.collectionModel}"
    var="row"
    rows=""
    first="#{bindings.yourView.rangeStart}"
    emptyText="#{bindings.yourView.viewable ? 'No rows yet.' : 'Access Denied.'}"
    id="table" binding="#{ReconcileBean.table}" width="100%"
    partialTriggers="cmdXXXXXX">
    <f:facet name="selection">
    <af:tableSelectMany text="Select and ...">
    <af:commandButton text="your message"
    action="#{ReconcileBean.handleSaved}"/>
    </af:tableSelectMany>
    </f:facet>
    </af:table>
    2. Pagedef:
    under <executables>
    <variable Name="find_fileId" Type="oracle.jbo.domain.Number"
    IsQueriable="false"/>
    </executables>
    under <bindings>
    <methodAction id="sendToTibco"
    InstanceName="yourAppModuleDataControl.dataProvider"
    DataControl="yourAppModuleDataControl" MethodName="sendToTibco"
    RequiresUpdateModel="true" Action="999"
    IsViewObjectMethod="false">
    <NamedData NDName="fileID" NDValue="${bindings.find_fileId}"
    NDType="oracle.jbo.domain.Number"/>
    </bindings>
    3. backbean:
    public String handleSaved() {
    // Add event code here...
    invokeMethod("sendToTibco");
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.getTable());
    return null;
    4. AppModuleImpl:
    import java.sql.CallableStatement;
    import java.sql.SQLException;
    import java.sql.Types;
    public void sendToTibco(Number fileID) {
    CallableStatement st = null;
    System.out.println("file id:" + fileID);
    try
    String stmt = "begin XXXmgr.XXX_XXXX_proc(?,?,?); end;";
    // I have a SP with one IN and two OUT.
    st = getDBTransaction().createCallableStatement(stmt, 0);
    st.registerOutParameter(2, Types.VARCHAR);
    st.registerOutParameter(3, Types.VARCHAR);
    st.setObject(1,fileID);
    st.execute();// 5. Execute the statement
    } catch (SQLException e)
    e.printStackTrace();
    throw new JboException(e);
    } finally
    if (st != null)
    try
    st.close();
    } catch (SQLException unused)
    log.error("Error encountered in sendToTibco method", unused);
    After you wrote the method, you need to move from "Available:" to "Selected" from "Client interface" of your AppleModule. so in Pagedef you click this AM you will see this method.
    Edited by: albertpi on Mar 22, 2010 12:42 PM
    Edited by: albertpi on Mar 22, 2010 12:43 PM
    Edited by: albertpi on Mar 22, 2010 12:46 PM

  • Dynamic Page that calls DB procedure to update data gets PLS222 or PLS306

    This seems a bit odd to me: I'm getting either "procedure no in scope" (when I call a procedure with the right args) or "wrong # or type of arguments" (when I call it with the wrong ones, so it is checking the procedure) in a dynamic page.<P>
    I'm trying to build a dynamic page that will display data and checkboxes (basically to get around the multi-select limitations -- management has told me that the "fake" md form is not acceptable)<P>
    So I build the page, it displays the data just fine exactly as we want it to:<P>
    <HTML><FORM><ORACLE>declare
    p_mdoc_user portal.wwv_utl_api_types.vc_arr;
    p_mdoc_user_seq portal.wwv_utl_api_types.vc_arr;
    p_seg_id portal.wwv_utl_api_types.vc_arr;
    p_cb portal.wwv_utl_api_types.vc_arr;
    p_action varchar2(20):='Save Changes';
    begin
    htp.p('Select your segments');
    htp.p('< p>');
    htp.p('<table border=2 cellpadding=2 cellspacing=0>');
    htp.tablerowopen;
    htp.tableheader('Seg#');
    htp.tableheader('Included');
    htp.tablerowclose;
    for r1 in (select seg_id, build_seg
    from web.mdoc_create_seg
    where mdoc_user = :mdoc_user
    and mdoc_user_seq = :mdoc_user_seq)
    loop
    htp.p('<input_type="hidden" name="p_mdoc_user" value='||:mdoc_user||'>');
    htp.p('<input_type="hidden" name="p_mdoc_user_seq" value='||:mdoc_user_seq||'>');
    htp.p('<input_type="hidden" name="p_seg_id" value='||to_char(r1.seg_id)||'>');
    htp.p('<tr><td>');
    htp.p(r1.seg_id);
    htp.p('</td><td>');
    if r1.build_seg='TRUE' then
    htp.p('<input type="checkbox" name="p_cb" value="Y" checked>');
    else
    htp.p('<input type="checkbox" name="p_cb" value="Y">');
    end if;
    htp.p('</td></tr>');
    end loop;
    htp.p('</table>');
    htp.p('< p>');
    /*note, this is where I'm putting in a procedure call to update*/
    end;
    </ORACLE></FORM></HTML><P>
    so then I try to add the procedure call (where the sql*plus comment is above)<P>
    htp.p('<input type="button" value="Save Changes" onclick='||
    mdoc_seg_create_choice_p(
    p_mdoc_user,
    p_mdoc_user_seq,
    p_seg_id,
    p_cb)
    ||'>');<P>
    When I try to run as portlet, I get pls 222 not in scope. <but>
    When I take a value out (say remove the last ",p_cb") - I get pls 306 wrong number or type of args to call.<P>
    I've granted the procedure and its underlying tables to portal/public/and portal_public, even though I'm building the dynamic page under a DB provider that is the same as the schema I wrote the procedure in.<P>
    I've tried specifying the schema, using a public synonym, and putting it in a package: same thing occurs, either I get pls 00222 not in scope when I call it with the right columns, or if I purposefully leave one out I get PLS 00306 wrong # or type of args.<P>
    Any ideas?
    -Mike

    Hi guys
    Check out the last 2 posts in this thread for ideas on how to implement 1.
    Report on user data from LDAP
    Varad

  • Calling Stored Procedure(takes varray of objects as input) from jdeveloper

    How can i call Stored Procedure which takes varray of objects as input from jdeveloper
    My object is :
    TYPE Entry IS Object (
    Name VARCHAR2(1024),
    Value VARCHAR2(1024)
    & the varray is :
    TYPE EntryArr IS varray(10) OF Entry ;
    & the procedure is :
    PROCEDURE myProc( myEntryArr IN EntryArr )
    AS
    s varchar2(1024);
    BEGIN
    for i in 1.. myEntryArr .COUNT loop
    if myEntryArr(i).Name = 'Name1' then
    s := myEntryArr(i).Value
    end loop;
    end;

    hi 429071
    Maybe you can find some useful information in:
    "Oracle Database Java Developer's Guide"
    http://download-west.oracle.com/docs/cd/B14117_01/java.101/b12021.pdf
    see "6 Publishing Java Classes With Call Specs" > "Writing Object Type Call Specs"
    success
    Jan Vervecken

  • Getting ora-00900 error when calling the procedure with the dynamic sql.

    create or replace procedure dyn_update(tab in varchar2,col in VARCHAR2) as
    BEGIN
    execute IMMEDIATE 'update'||tab||'set'||col||'= 0 where order_id=2458';
    end;
    and when i call this procedure in sql developer or sql* plus using
    begin
    dyn_update('Orders',Order_status');
    end;
    I am getting the oracle 0ra 00900 error.
    can any one please help me

    just a tip:
    Create your dynamic string in a local variable, so you can easily see why it is giving an exception
    create or replace procedure dyn_update(tab in varchar2,col in VARCHAR2) as
       str varchar2(32767);
    BEGIN
       str := 'update '||tab||' set'||col||'= 0 where order_id=2458';
       dbms_output.put_line (str);
      execute IMMEDIATE str;
    end;

  • Calling a procedure dynamically in forms

    Hi all
    I'm using Oracle 6, is there anyway to call a procedure dynamically, i mean the procedure called differs according to a certain condition. The procedure is local in the form not in the database, how can this be achieved
    Thanks

    Hello,
    user497979 wrote:
    what i want is as the following
    IF cond = 1 THEN
    proc1;
    ELSIF cond = 2 THEN
    proc2;
    ELSIF cond = 3 THEN
    proc3;
    .................. so onWell, i think the way you are showing with IF CONDITION is smart enough to call the procedures. And it will be also easy to understand.
    I'm searching for a way to call the procedure as follows
    proc||cond for exampleBut why? What is the purpose to do like this? Any efficiency or any logical reason?
    Another option You can create one procedure and call the code depend on parameter you pass like
    PROCEDURE MY_PROC(pCond IN NUMBER) IS
    BEGIN
      IF pCond=1 THEN
        -- Do something here...
      ELSIF pCond=2 THEN
       -- Do something here...
      ELSE
       -- Do something here...
      END IF;
    END;And while calling the procedure you can call the procedure by passing the value of pCond upon your requirement like
    MY_PROC(<parameter value>);But still the IF CONDITION exists either you use inside or outside the procedure.
    -Ammad

  • How to call a procedure from dynamic page?

    I am trying to submit a form (dynamic page) to a procedure but keep getting the generic page not found error.
    I have the following dynamic page (bind variable works properly):
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <oracle>
    declare
    v_job_id number := :job_id;
    begin
    htp.p(v_job_id);
    htp.formOpen('http://mssdiscovery.ssc.nasa.gov:7777/pls/portal/portal_public.buy_off', 'post');
    htp.formHidden('JOBID', v_job_id);
    htp.formSubmit('submit', 'Buy Off');
    htp.formClose;
    end;
    </oracle>
    </BODY>
    </HTML>
    This form should submit to a procedure called "BUY_OFF", defined in the PORTAL_PUBLIC schema as follows:
    Create or Replace PROCEDURE PORTAL_PUBLIC.BUY_OFF
    (JOBID IN number)
    as
    begin
    update portal_public.components_jobs_syn
    set
    status = 'COMPLETE'
    where job_id = JOBID;
    /* add code to redirect */
    exception
    when others then
    null;
    end;
    I have granted PORTAL and PUBLIC execute privileges.
    I have never been able to submit a form in a dynamic page to a procedure... it never works... someone please help me out! What am I missing?

    Nevermind... I changed the submit button name from submit to NULL and it works fine now. I guess the name flipped it out for some reason.

  • Calling stored procedures from entity object and application module

    Hello
    I've put in place an EntiyImpl base class containg helper methods to call stored procedures.
    I now need to call stored procedures from the application module.
    Apart from creating an application module base class and duplicating the helper method code is there a way
    to share the helper methods for calling stored procedures between the entity impl and application module impl ?
    Regards
    Paul

    Does the helper code depend on features of a particular entity object instance, beyond its database transaction?
    If so, I'm not sure I see how it could be used from an application module class.
    If not, here's what you do:
    Step 1:
    Parametrize the database transaction--you might even want to. So instead of
    protected myHelperMethod(Object someParam) {
    DBTransaction trans = getDBTransaction();
    change this to
    protected myHelperMethod(DBTransaction trans, Object someParam) {
    Step 2: make the method public and static--once you parameterize the DBTransaction, you should be able to do this.
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    Step 3: Remove the method from your EntityImpl base class into a utility class:
    public abstract class PlSqlUtils {
    private PlSqlUtils() {}
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    When you want to call the method from an application module, entity object, or even view object class, call
    PlSqlUtils.myHelperMethod(getDBTransaction(), paramValue);
    Unlike Transaction.executeCommand(), this lets you provide functionality like setting procedure parameter values, retrieving OUT parameter values, etc.
    Hope this helps,
    Avrom

  • Dynamically call another procedure

    In SQLServer you can have a variable that holds a procedure
    name. The variable can then be used in the execute statement.
    Is there any way in PLSQL to dynamicaly call another procedure.
    example:
    begin
    declare procname varchar2(32) = 'proc1';
    --now call the procedure
    procname -- ?
    execute immediate procname -- ?
    end;
    Thanks,
    Dermot.

    Just wrap it in an anonymous block:
    create or replace procwrap
    (p_procname in varchar2)
    is
    begin
    execute immediate 'begin ' || p_procname || '; end;';
    end;

  • Two related questions: using htmldb_Get to call stored procedure and passing in an array of items

    I have the need to save dynamically generated ApEx items via AJAX.  I am using APEX_ITEM API to generate the items.  At run-time, I have no idea how many of items will be generated on the page, but I know that they will all have discreet and distinct "name" attributes, i.e. f01, f02, f03, etc.  As a basic example, if I have to generate a select list, I know that the "p_idx" parameter of the APEX_ITEM call is say "3", so all select lists that get generated will have a "name" attribute in the DOM of "f03", all text items will be "f01", etc.
    I want to save this data to the database via AJAX.  It is typical to call the standard htmldb_Get javascript function for use of an on-demand process, but I am interested in using the rarely-called-upon "procedure" and queryString" options of that javascript function so that I can build the queryString on the fly based on what is on the DOM when the tries to save the data they entered into these APEX_ITEM-generated items.  Does anyone have any good examples of how to use the "procedure" and "queryString" parameters of the htmldb_Get javascript function?
    I have found a smattering of some blogs, posts, etc. online related to this, but mostly just people regurgitating the documentation.  I found this post (https://forums.oracle.com/thread/2549237) which had a glimpse of hope to be able to pass an array (which is something I will need) as a parameter, but would like someone to sanity check this before I go down that road.
    Shane.
    ApEx 4.2.1

    Shane
    Since you mention you are on APEX 4.2  I would recommend using apex.server.process which is the documented replacement of the officially undocumented htmldb_Get.
    In the documentation it is set that the first parameter is the ajaxidentifier but it actually is the process name.
    The data object would be something like
    var lData ={f01 : get_value_array('f01')}
    Where get_value_array is
    function get_value_array(pColumnName) {
      var l_values =[];
      apex.jQuery('[name="'+pColumnName+'"]').each(
       function(){
        var l_value;
        l_value = apex.item(this.id).getValue();
        l_values.push(l_value);
      return l_values
    For a working example see this demo.
    Nicolette

  • Unable to call a procedure from another procedure

    Hi there,
    I have created two procedures under my user login. Both of them have the same parameters.
    I was trying to call the other procedure from one procedure and am getting error message.
    Both the procedures are saved in different files. I am using LINUX command editor.
    Precedure1:
    CREATE PROCEDURE remove_emp (emp_no number) as
    BEGIN
    delete from sailors s where s.s_no = remove_emp.emp_no;
    END;
    Procedure2:
    CREATE PROCEDURE u_table (del_emp number) as
    BEGIN
    exec remove_emp(del_emp);
    END;
    /While am calling, this is what I am getting
    SQL> exec u_table(1003);
    BEGIN u_table(1003); END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00905: object RAJIV.U_TABLE is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignoredPlease help me with this.
    Thanks
    Rajiv
    Message was edited by:
    RajivTx

    First thing..
    PLS-00905: object RAJIV.U_TABLE is invalidMeans..the procedure is not valid...meaning not compiled properly...because...u were using "exec remove_emp(del_emp);".... reason being is exec is valid in Sql*Plus... and u cant use it in a procedure ..with the same syntax ( dont ask me why..) unless u use dynamic sql.. u can directly call the procedure like...
    CREATE PROCEDURE u_table (del_emp number) as
    BEGIN
    remove_emp(del_emp);
    END;
    delete from sailors s where s.s_no = remove_emp.emp_no;Secondly ... (Just a suggestion).... aliases are better used when u have multiple tables and complex queries..or may be sometimes the table name is too long and confusing... avoid them when not neccessary

Maybe you are looking for