How to write a procedure

hii am new to oracle , can u help me how to write a procedure for the following query
Transfer Funds between Accounts:
Table: AccountMaster (AcctNo (primary key), AcctHolderName, currentBal
Data: 1, 'A', 1000
2, 'B', 3000
3, 'C', 4000
Function: getBalance (AcctNo)
Stored Proc: tranferFunds (FromAcctNo IN, ToAcctNo IN, Amt IN, result OUT)
The proc should use the function getBalance (AcctNo) to find out the current balance for account.
The proc should return a value of 1 if the transfer was successful.
It should return a value of -1 if the funds are not sufficient in the fromAccount to transfer.
Thanx ,
Raj0412

I would start by asking your teacher to clarify the parts of the assignment that are not clear to you.
You may also want to read some books.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm

Similar Messages

  • How to write a procedure for update the table

    Hi all
    can any body please tell me how to write a procedure to update the table......
    I have a table with about 10,000 records...........Now I have add a new column and I want to add values for that like
    registration Code Creidits
    13213 BBA
    1232 MCS
    I had add the creidit now i want to update the table.........the new value want to get by SQL like
    Creidit = select creidit from othere_table...........
    Hope u can understand my problem
    Thanks in advance
    Regards
    Shayan
    [email protected]

    Please try the following --
    update Program_reg a
    set TotalCreidit = ( select tot_cr <Accroding to your logic>
                                from Program_reg b
                                where a.Registration = b.Registration
                                and    a.Enrollment = b.Enrollment
                                and    a.code = b.code
    where a.Registration in ( select distinct Registration
                                        from Program_reg );
    N.B.: Not Tested....
    Regards.
    Satyaki De.

  • How to write a procedure to run the call the custom package from backend

    Hi All
    Oracle 10g
    Oracle Apps R12
    I am working with oracle order management here we have a customize Package called (Pick Release).Due to some problem we have running this concurrent program by manually giving Route_id as parameter. The route_id is taken from the route Table. By using this query
    select distinct route_id from route@DB_LINK_APPS_TO_ROADSHOW
    where trunc(route_date) = trunc (sysdate+2).
    so daily we have nearly 42 routes and we are running this concurrent program manually nearly times.
    so now how to write a procedure for this
    Step 1 Getting the route from route table.( By cursor we can get the route_id Accordingly)
    Step 2 How to trigger the custom package from back end and execute accordingly to that output of the cursor(route_id)
    If the cursor get 40 routes is it then the concurrent program runs 40 times according to that route_id.
    can some could provide the steps to do this
    Thanks & Regards
    Srikkanth.M

    This is about 4 or 5 lines of PL/SQL and the name of the custom package is not provided.
    If you request someone in this forum to do your work for free -because obviously you didn't even try to write it, which must be considered abusing this forum- you must at least provide sufficient info so someone can do it.
    And no, I won't do it for you.
    Sybrand Bakker
    Senior Oracle DBA

  • How to write such procedure?

    I have a DML trigger on a table. whenever there is a change to the table, the old records will be written to another backup table created before. I want to implement this for many tables in the database. Basically, I want a procedure that takes table name as an input and creats a backup table and a trigger for the input table.
    How to write such procedure?
    thanks.

    ...a simple block to get you started...not tested:
    declare
      t varchar2(64) := 'my_table'; --your table name as a parameter
    begin
      execute immediate 'create table '  || t || '_bck as select * from user_tables where 1 = 0';
      -- thinking you'd create the trigger on your base table, not the backup
      execute immediate 'create trigger ' || t || '_dml_trigger before delete or insert or update on ' || t || ' referencing...you get the point
    end;Hope this helps. If you're not the DBA you may want to discuss this train of thought with him/her.
    Cheers.

  • How to write a procedure to load the data into a table using xml file as input to the procedure?

    Hi,
    Iam new to the xml,
    can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
    <?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>.
    Regards,
    vikram.

    here is the your XML parse in 11g :
    select *
      from xmltable('//Entity' passing xmltype
    '<?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>
    ') columns
      "dcode" varchar2(4000) path '/Entity/dcode',
      "ddesc" varchar2(4000) path '/Entity/ddesc',
      "reauthflag" varchar2(4000) path '/Entity/reauthflag'
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    Using this parser you can create procedure as
    SQL> create or replace procedure myXMLParse(x clob) as
      2  begin
      3    insert into MyXmlTable
      4      select *
      5        from xmltable('//Entity' passing xmltype(x) columns "dcode"
      6                      varchar2(4000) path '/Entity/dcode',
      7                      "ddesc" varchar2(4000) path '/Entity/ddesc',
      8                      "reauthflag" varchar2(4000) path '/Entity/reauthflag');
      9    commit;
    10  end;
    11 
    12  /
    Procedure created
    SQL>
    SQL>
    SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
    PL/SQL procedure successfully completed
    SQL> select * from MYXMLTABLE;
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    SQL>
    Ramin Hashimzade

  • How to write a procedure to retrieve data in a collection from a table?

    create or replace type Subject as object(
    subject_id number,
    subject_Desc varchar2(50)
    create or replace type Subjects_All as varray(10) of Subject
    create table student(
    StudentID varchar(10),
    Subjects Subjects_all
    so how do i write a procedure to display info such as this:
    Subjects:
    101 'Maths'
    102 'Science'
    Subjects:
    I wrote a procedure like the following but it didn't quite work :(
    CREATE OR REPLACE PROCEDURE StudentLoop AS
    all_subj subjects_all;
    each_subj subject;
    CURSOR all_subjectsrow IS select * from student;
    BEGIN
    FOR all_subj IN all_subjectsrow LOOP
    FOR each_subj IN all_subj LOOP
    DBMS_OUTPUT.PUT_LINE('Last row selected has ID ' || each_subj.subject_id || each_subj.subject_desc );
    END LOOP;
    END LOOP;
    END StudentLoop ;
    Any Advice?

    Hello,
    1.) Don't store Types in Tables. It will become a nightmare when you want to query your data any other way then retrieving your object types. Just don't do it.
    2.) A more relational model is much easier. Considering students and subjects is a n:n relation (a student can have more subjects and a subject can have more students) this might look like this:
    SQL> r
      1  declare
      2    cursor cStudents is
      3      with student as (
      4        select 1 student_id, 'test1' name from dual
      5        union all
      6        select 2 student_id, 'test2' name from dual
      7      ),
      8      subjects as (
      9        select 1 subject_id, 'Maths' subject_desc from dual
    10        union all
    11        select 2 subject_id, 'Science' subject_desc from dual
    12      ),
    13      student_subjects as (
    14        select 1 student_id, 1 subject_id from dual
    15        union all
    16        select 1 student_id, 2 subject_id from dual
    17        union all
    18        select 2 student_id, 2 subject_id from dual
    19      )
    20      select a.name name, b.subject_desc subject
    21      from student a, subjects b, student_subjects c
    22      where a.student_id = c.student_id
    23      and b.subject_id = c.subject_id;
    24  begin
    25    for rS in cStudents loop
    26      dbms_output.put_line('Student '||rS.name||': '||rS.subject);
    27    end loop;
    28* end;
    Student test1: Maths
    Student test2: Science
    Student test1: Sciencecheers

  • How to write stored procedures

    hi
    how you will write stored procedures in jdbc .could u pls tell me the procedure?what is key in jdbc where you will use that in which situation?could ugive me the answer briefly
    thanks
    nag

    Hi
    A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database.
    Stored procedures are similar to user-defined functions (UDFs).
    A stored procedure is a group of SQL statements that form a logical unit and perform a particular task, and they are used to encapsulate a set of operations or queries to execute on a database server
    Use this
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    Thanks

  • How to write a procedure with the table name as an argument

    I'm very new to Oracle, usually developing in SQL server.
    I would like to write a procedure that accepts a table name and then does a
    SELECT * FROM [table name] order by CollectionDate.
    In SQL I would build up a varchar variable and then execute it.
    Thanks

    I often wonder why so many people new to Oracle want to do this as a first step, when most people who know what they are doing try and avoid it.
    SQL> create or replace function f (p_tab varchar2)
      2  return sys_refcursor as
      3    c sys_refcursor;
      4  begin
      5    open c for
      6      'select * from ' || p_tab || ' order by hiredate';
      7    return c;
      8  end;
      9  /
    Function created.
    SQL> var c refcursor
    SQL> exec :c := f('emp')
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          MGR HIREDATE      SAL   COMM DEPTNO
      7369 SMITH      CLERK       7902 12/17/1980    800            20
      7499 ALLEN      SALESMAN    7698 02/20/1981   1600    300     30
      7521 WARD       SALESMAN    7698 02/22/1981   1250    500     30
      7566 JONES      MANAGER     7839 04/02/1981   2975            20
      7698 BLAKE      MANAGER     7839 05/01/1981   2850            30
      7782 CLARK      MANAGER     7839 06/09/1981   2450            10
      7844 TURNER     SALESMAN    7698 09/08/1981   1500      0     30
      7654 MARTIN     SALESMAN    7698 09/28/1981   1250   1400     30
      7839 KING       PRESIDENT        11/17/1981   5000            10
      7900 JAMES      CLERK       7698 12/03/1981    950            30
      7902 FORD       ANALYST     7566 12/03/1981   3000            20
      7934 MILLER     CLERK       7782 01/23/1982   1300            10
      7788 SCOTT      ANALYST     7566 12/09/1982   3000            20
      7876 ADAMS      CLERK       7788 01/12/1983   1100            20
    14 rows selected.
    SQL>Note if you pass in a value to be used in the where clause like deptno, you should not use this technique, but use bind variables intead like this -
    Wrote file afiedt.sql
      1  create or replace function f (p_tab varchar2, p_deptno number)
      2  return sys_refcursor as
      3    c sys_refcursor;
      4  begin
      5    open c for
      6      'select * from ' || p_tab
      7        || ' where deptno = :p_deptno order by hiredate'
      8        using p_deptno;
      9    return c;
    10* end;
    SQL> /
    Function created.
    SQL> exec :c := f('emp', 10)
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          MGR HIREDATE      SAL   COMM DEPTNO
      7782 CLARK      MANAGER     7839 06/09/1981   2450            10
      7839 KING       PRESIDENT        11/17/1981   5000            10
      7934 MILLER     CLERK       7782 01/23/1982   1300            10
    SQL>

  • How to write a procedure using collections

    how can we define collections inside procedure and use it
    i am getting an error executing this proc
    create or replace procedure p_collections
    is
    type calendar is varray(366) of  date;
    calendar c1;
    begin
    for i in 1 .. 100
    loop
    select sysdate bulk collect into c1 from dual;
    end loop;
    DBMS_OUTPUT.PUT_LINE(c1);
    end;Edited by: Rahul_India on Sep 12, 2012 2:54 PM
    Edited by: Rahul_India on Sep 12, 2012 3:07 PM

    That's because you only have one value in the array.
    Here is sample code that you can test in the SCOTT schema.
    set serveroutput on;
    declare
      cursor my_cur is
      select empno from emp;
      type my_type is table of emp.ename%type;
      type my_type2 is table of emp.empno%type;
      dizi my_type;
      dizi2 my_type2;
      query VARCHAR2(100);
    begin
      open my_cur;
      fetch my_cur bulk collect into dizi2;
      close my_cur;
      for i in dizi2.first..dizi2.last
      loop
        dbms_output.put_line(dizi2(i));
      end loop;
    end;
    /Or another sample using a LIMIT clause
    The FETCH does a BULK COLLECT of all data into 'v'. It will either get all the data or none if there isn't any.
    The LOOP construct would be used when you have a LIMIT clause so that Oracle would 'loop' back to
    get the next set of records. Run this example in the SCOTT schema and you will see how the LIMIT clause works.
    I have 14 records in my EMP table.
    DECLARE
      CURSOR c1 IS (SELECT * FROM emp);
      TYPE typ_tbl IS TABLE OF c1%rowtype;
      v typ_tbl;
    BEGIN
      OPEN c1;
      LOOP                                                 --Loop added
        FETCH c1 BULK COLLECT INTO v LIMIT 3; -- process 3 records at a time
            -- process the first 3 max records
           DBMS_OUTPUT.PUT_LINE('Processing ' || v.COUNT || ' records.');
            FOR i IN v.first..v.last LOOP
                DBMS_OUTPUT.PUT_LINE(v(i).empno);
            END LOOP; 
        EXIT WHEN c1%NOTFOUND;
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('All done');
    END;In the FOR loop you would do any processing of the nested table you want to do
    and could use a FORALL to do an INSERT into another table.

  • How to write Stored Procedures in JDBC

    Hello EveryBody,
    I have written the following code.
    String str="create procedure info @tempdate varchar(15),@tfno varchar(10)" +
    "as" +
    "begin" +
    "if exists ( select * from details where tdate=@tempdate,fno=@fno"
    ......is there any error...i am getting error at line1.."asbeginif"

    duffymo's point about newlines is exactly on target. Once the stored procedure is stored in the database, you want it to be human readable with the standard utilities, not stored as one long run-on single line. Back when I was consulting, we sometimes charged large sums for simply reformatting a SP to make it readable. On one memorable job, 95% of the bill was for cleaning up that and other formatting issues; the rest was for tracing through execution paths to find the ">" that should have been a ">=".
    You can and probably should put the newlines directly in your java source, e.g.:
    final String str="create procedure info @tempdate varchar(15),@tfno varchar(10)\n" +
    "as\n" +
    "begin\n" +
    "if exists ( select * from details where tdate=@tempdate,fno=@fno\n"
    ...

  • How to write stored procedure to spool data into file

    Hi ,
    We get differnt excel sheets of differnt products.
    We upload data from excel sheet to database . After uploading data , I run Preprossor (sql script) to check the data
    This preprocessor script contains several select statements that query different tables in database .the output is spooled into a cvs file .
    I need to change this script into a stored procedure and spool the output to cvs file.
    File spooling should be done inside the stored procedure so that if I call this stored procedure from java program ,or any concurrent program,its output is .cvs file and in parameter should be productname.
    But inside the stored procedure , we cannot spool the data to some .cvs file . Is any way.I do not want to spool to file when calling.It should be inside stored procedure.
    Or do I need to create a table and insert all the select statements output into it .
    Here is the sample preprocessor script.
    spool Graco_Product.csv
    set head off
    set feedback off
    set Pagesize 100
    SELECT '1. EVERY ASSEMBLY GROUP ADDED IN sys_PRODUCT TABLE MUST HAVE AT LEAST ONE ITEM IN WOC_ASSEMBLY_ITEM'
         FROM DUAL;
    SELECT 'ASSEMBLY_GROUP_NAME'
         FROM DUAL;
    SELECT
         assembly_group_name
         FROM association
         WHERE product_model_name = 'Graco_Product'
         AND assembly_group_name NOT IN (SELECT DISTINCT assembly_group_name FROM woc_assembly_item);
    SELECT '2. A RULE SHOULD HAVE AT LEAST ONE EXPRESSION FOR ITS ACTION SIDE.'
         FROM DUAL;
    SELECT 'RELATION_ID , RELATION_TYPE'
         FROM DUAL;
    SELECT wr.Relation_ID                    ||','||
         wr.Relation_Type                    
         FROM WOC_Relation wr
         WHERE NOT EXISTS (SELECT 'X' FROM WOC_Relation_Expression wre
    WHERE wre.Relation_Side = 'Action'
    AND wr.Relation_ID = wre.Relation_ID)
         AND wr.Relation_Type NOT IN ( 'Rule Warning','Rule Resource','Rule Default');
    SELECT '3. PROPERTIES USED IN RULES SHOULD EXIST IN WOC_PROPERTY_MASTER -- EXP_LHS_VALUE'
         FROM DUAL;
    SELECT
         'RELATION_OWNER,EXP_LHS_OPERAND,RELATION_SIDE,RELATION_ID,EXP_LHS_VALUE,RELATION_TYPE'     
         FROM DUAL;
    SELECT
         b.relation_owner               ||','||
         a.exp_lhs_operand               ||','||
         a.relation_side                    ||','||
         a.relation_id                    ||','||
         a.exp_lhs_value                    ||','||
         b.relation_type
         FROM woc_relation_expression a, woc_relation b
         WHERE a.exp_lhs_value IS NOT NULL
         AND a.exp_lhs_value_type = 'Property'
         AND a.exp_lhs_value NOT IN (SELECT property_name FROM woc_property)
         AND b.product_model_name = 'Graco_Product'
         AND a.relation_id = b.relation_id;
    SELECT '--------------------------------------------------------------------------------'
    from dual;
    spool off
    set head on
    set feedback on

    High level description
    Full documentation
    Note that the UTL_ and DBMS_ packages are all covered in the PL/SQL Packages and Types Reference.
    You may also want to read up on the CREATE DIRECTORY statement, which lets you refer to an actual OS directory (which you create separately) via a database object.

  • How to write this procedure

    hi,
    i want to create a procedure,which can create view when it works.i do it
    as follow,but it shows 'compile errors',what's the matter,could someone
    help me?
    create or replace procedure p_mc_view
    (n in varchar) is
    begin
    n:=edit1.text;
    create view view_1 as select mc_name,provider,per_cost from material_tie
    where mc_id in (select mc_id from material_cost where mc_type=n);
    alter view view_1 add column cost as select cost(mc_number*mc_cost) from
    material_cost where mc_type=n;
    ADOTable1.tablename:='view_1';
    ADOTable1.active:='true';
    end;
    here edit1.text is a component of my interface programe.
    ribok
    thanks!

    hi
    Jameel you made one mistake IN mode parameter cannot be assigned a value.
    SQL> create or replace procedure p_mc_view (n in varchar2) as
      2  begin
      3  n:=edit1.text;
      4  execute immediate 'create view view_1 as select
      5  mc_name,provider,per_cost from material_tie where mc_id in (select mc_id
      6  from material_cost where mc_type='|| n ||')';
      7  execute immediate 'alter view view_1 add cost number as select cost(mc_number*mc_cost) from
      8  material_cost where mc_type='||n ;
      9  end;
    10  .
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> show error
    Errors for PROCEDURE P_MC_VIEW:
    LINE/COL ERROR
    3/1      PLS-00363: expression 'N' cannot be used as an assignment target
    3/1      PL/SQL: Statement ignored
    SQL> create or replace procedure p_mc_view (n in varchar2) as
      2  begin
      3  --n:=edit1.text;
      4  execute immediate 'create view view_1 as select
      5  mc_name,provider,per_cost from material_tie where mc_id in (select mc_id
      6  from material_cost where mc_type='|| n ||')';
      7  execute immediate 'alter view view_1 add cost number as select cost(mc_number*mc_cost) from
      8  material_cost where mc_type='||n ;
      9  end;
    10  .
    SQL> /
    Procedure created.
    Khurram Siddiqui
    [email protected]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to write stored procedures and triggers in oracle

    hai friends ,
    i don't know about storedprocedures and trigger.please help on this
    issues

    Have you tried the documentation yet? PL/SQL Architecture seems to be a good start.
    C.

  • How to write test procedures of the following code, need someones help

    ITS VERY URGENT.....PLEASE SEND ME THE REPLY ON MY EMAIL ID [email protected]
    // Account.java - Data class for account files
    // MODULE INDEX
    // NAME CONTENTS
    // Account Constructor
    // Account Constructor
    // getAccountNo Get account identifier
    // getAccountType Get account type
    // getCustNo Get customer identifier
    // getBalance Get balance
    // getCurCode Get currency code
    // setAccountNo Set account identifier
    // setAccountType Set account type
    // setCustNo Set customer identifier
    // setBalance Set balance
    // setCurCode Set currency code
    // MAINTENANCE HISTORY
    // DATE PROGRAMMER AND DETAILS
    // 6-5-08 TLT Original
    // IMPORTATIONS
    import java.util.*;
    import java.lang.*;
    // CLASS DECLARATIONS
    public class Account
    // INSTANCE DATA
    private String accountNo; //Account identifier
    private String accountType; //Account type
    private String custNo; //Customer identifier
    private double balance; //Balance
    private String curCode; //Currency code
    // CLASS CONSTRUCTOR
    Account (
    String accountNo) //Account idenfier
         this.accountNo = accountNo;
    Account (
         String accountNo, //Account identifier
         String accountType, //Account type
         String custNo, //Customer identifier
         double balance, //Balance
         String curCode) //Currency code
    this.accountNo = accountNo;
    this.accountType = accountType;
    this.custNo = custNo;
    this.balance = balance;
    this.curCode = curCode;
    // Get account identifier
    String getAccountNo () {
    return accountNo;
    // Get account type
    String getAccountType () {
    return accountType;
    // Get customer identifier
    String getCustNo () {
    return custNo;
    // Get balance
    double getBalance () {
    return balance;
    // Get currency code
    String getCurCode () {
    return curCode;
    // Set account identifier
    void setAccountNo (
    String accountNo)
    this.accountNo = accountNo;
    // Set account type
    void setAccountType (
    String accountType)
    this.accountType = accountType;
    // Set customer identifier
    void setCustNo (String custNo) {
    this.custNo = custNo;
    // Set balance
    void setBalance (double balance) {
    this.balance = balance;
    // Set currency code
    void setCurCode (String curCode) {
    this.curCode = curCode;
    }

    123shweta wrote:
    ITS VERY URGENT.....W00t? Well if its soo urgent then perhaps you should learn from this and do some planning ahead in the future so you dont find ur self in these urgent needs.
    PLEASE SEND ME THE REPLY ON MY EMAIL ID [email protected]
    Wat tha.., do you expect someone to just magically solve your problem for ya just like that? with an half asked question even.
    Last but not least.. Why would you even need an test for an getters and setter class?

  • Write a procedure to check the count is less than 1300 for every 3 hours

    Good Morning all,
    I want to write a procedure to check the count is less than 1300 for every 3 hours
    Query:*
    Select count(*) from sample where trx_date=sysdate;
    I want to run this query every 3 hours daily
    If the count is less than 1300 every 3 hours, we should sent a reminder mail like 'Data not copy'.
    Please help me how to write a procedure.

    hi there
    first
    --define the SMTP_OUT_SERVER parameter in your init.ora initialization file
    --ALTER SYSTEM SET smtp_out_server='my.domain.com' SCOPE=SPFILE;
    after that create a procedure
    CREATE OR REPLACE procedure SCOTT.hrsmail
    is
    v_count number;
    begin
    Select count(*)  into v_count from emp;
    if v_count < 1300
    then
      UTL_MAIL.send(sender    => '[email protected]',
                      recipients => '[email protected]',
                      cc         => '[email protected]',
                      bcc        => '[email protected]',
                      subject    => 'Testing the UTL_MAIL Package',
                      message    => 'If you get this, UTL_MAIL package
    else
    null;   --what you want to do here
    end if ;
    end;
    /we should create a job which run after every 3 hrs and send a reminder mail like 'Data not copy'.
    BEGIN
      SYS.DBMS_JOB.REMOVE(373);
    COMMIT;
    END;
    DECLARE
      X NUMBER;
    BEGIN
      SYS.DBMS_JOB.SUBMIT
      ( job       => X
       ,what      => 'begin hrsmail; end;'
       ,next_date => to_date('14/02/2011 18:39:29','dd/mm/yyyy hh24:mi:ss')
       ,interval  => 'SYSDATE+3/24 '
       ,no_parse  => FALSE
      SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    COMMIT;
    END;
    /hope this will help you
    Regards
    Hitesh
    Edited by: Hitesh Nirkhey on Feb 14, 2011 3:34 PM

Maybe you are looking for