Procedure help

Hi there,
I am trying to write a procedure which calculates the remaining time from two different tables. The problem hereby is that one table (TBL_TIMESHEET) has the total for each day whereas the total for each day from the other table (TBL_COSTING) is calculated on the fly.
The query to get the all 7 days for one period is
SELECT
DAY_DATE,
TIMESHEET_DATA.calculate_hours_project(HOURS_TOTAL) HOURS_TOTAL,
TO_CHAR(DAY_DATE, 'yyyymmdd') DAY_ORDER_BY
FROM TBL_TIMESHEET
where USER_ID = in_user_id
AND PERIOD = in_period          
ORDER BY DAY_ORDER_BY ASC;
to get the hours from TBL_COSTING 7 days for one period is
SELECT
SUM(timesheet_data.calculate_hours_project(HOURS_THU)) HOURS_THU,
SUM(timesheet_data.calculate_hours_project(HOURS_FRI)) HOURS_FRI,
SUM(timesheet_data.calculate_hours_project(HOURS_SAT)) HOURS_SAT,
SUM(timesheet_data.calculate_hours_project(HOURS_SUN)) HOURS_SUN,
SUM(timesheet_data.calculate_hours_project(HOURS_MON)) HOURS_MON,
SUM(timesheet_data.calculate_hours_project(HOURS_TUE)) HOURS_TUE,
SUM(timesheet_data.calculate_hours_project(HOURS_WED)) HOURS_WED
FROM TBL_COSTING
WHERE USER_ID = in_user_id
AND PERIOD = in_period;
The problem now is that I need to subtract the value of the returned seven days of HOURS_TOTAL from table TBL_TIMESHEET from the value of the matching day of table TBL_COSTING. I have no idea to find out how I substract the right values from the right day.
I really appreciate your help, since this is spinning me out.....
Chris

I would suggest something like this:
SELECT DAY_OF_WEEK, SUM(HOURS_TOTAL) HOURS_LEFT FROM (
SELECT
TO_CHAR(DAY_DATE, 'DAY') DAY_OF_WEEK,
TIMESHEET_DATA.calculate_hours_project(HOURS_TOTAL) HOURS_TOTAL
FROM TBL_TIMESHEET
where USER_ID = in_user_id
AND PERIOD = in_period
UNION ALL
SELECT
'MONDAY' DAY_OF_WEEK,
- SUM(timesheet_data.calculate_hours_project(HOURS_MON)) HOURS_TOTAL
FROM TBL_COSTING
WHERE USER_ID = in_user_id
AND PERIOD = in_period
UNION ALL
SELECT
'TUESDAY' DAY_OF_WEEK,
- SUM(timesheet_data.calculate_hours_project(HOURS_TUE)) HOURS_TOTAL
FROM TBL_COSTING
WHERE USER_ID = in_user_id
AND PERIOD = in_period
UNION ALL
) GROUP BY DAY_OF_WEEK;

Similar Messages

  • Function & Procedure Help

    CUST- customer_num, first_name, last_name
    DELIVERY - customer_num, free_delivery
    INVOICE- customer_num, delivery, item_num
    INVENTORY - item_num, price
    using just these columns from these tables i have to create a detailed report as to which customers have spent over $700 using a procedure or a function...I then will have to go back into the delivery table and change free_delivery to "YES"
    I'm new to sql/pl and i've have tried so many different ways if any one could help me even begin with what directon i should go, I would be thankful
    UPDATE DELIVERY SET free_delivery='YES'
    WHERE customer_num IN(
    SELECT C.customer_num
    FROM CUST C
    INNER JOIN INVOICE INV ON C.customer_num=INV.customer_num
    INNER JOIN INVENTORY INVT ON INV.item_num=INVT.item_num
    GROUP BY C.customer_num
    HAVING SUM(INVT.price)>700)

    I hope you want to convert the above query into a function block that can be called several times. If that is the case, the below block might help.
    It will also allow you to pass the amount value by which you can update rows for dynamic amounts.
    FUNCTION free_delivery (f_amount NUMBER)
       RETURN BOOLEAN
    IS
       rvalue   BOOLEAN;
       v_rows_processed NUMBER;
    BEGIN
       UPDATE delivery
          SET free_delivery = 'YES'
        WHERE customer_num IN (SELECT   c.customer_num
                                   FROM cust c INNER JOIN invoice inv
                                        ON c.customer_num = inv.customer_num
                                        INNER JOIN inventory invt
                                        ON inv.item_num = invt.item_num
                               GROUP BY c.customer_num
                                 HAVING SUM (invt.price) > f_amount);
       v_rows_processed := SQL%ROWCOUNT;
       if (v_rows_processed > 0) then
        rvalue = TRUE;
       else
        rvalue = FALSE;
       end if;                               
       RETURN rvalue;
    END;If you want to commit the changes in the function itself it can be done, but not recommended.
    Just add commit after the if loop.

  • Plsql procedure help..

    Hi There,
    We're developing a procedure that takes a string, a delimiter, assign the individual tokens to variables, and return the variables to the calling program.
    Since I'm new to pl/sql, I'm not quite sure how to do the last bit (assign the tokens to the variables and return them to the calling program), and we we're looking at some help please. In other words, I have a loop, fetch a cursor into variable.. and we're wondering how can we assign the 1st value of the cursor to the 1st defined OUT variable in the procedure heading (the 2nd cursor value to the 2nd OUT variable, ..etc)?
    Here is the code:
    procedure string_to_tokens (in_str                IN varchar2,
                                    delim                      IN varchar2,
                        VENDOR_ID               OUT number,
                        CCF_ID                    OUT number,
                        PRR_ID                    OUT number,
                        CON_NAME                 OUT VARCHAR2,
                        CONT_TYPE_ID               OUT number,
                        DEPOSIT_DATE               OUT VARCHAR2,
                        CON_YEAR               OUT VARCHAR2,
                        CHG_NAME               OUT VARCHAR2,
                        CON_AMOUNT               OUT number,
                        TOT_AMOUNT               OUT number)
    is
         mystring varchar2(100);
         cursor str_cur is
         SELECT
               SUBSTR
                    ( in_str
                    , DECODE(LEVEL, 1, 1, INSTR(in_str, delim, 1, LEVEL-1)+1)
                    , INSTR(in_str, delim, 1, LEVEL) -
                      DECODE(LEVEL, 1, 1, INSTR(in_str, delim, 1, LEVEL-1)+1)
         FROM DUAL
         CONNECT BY INSTR(in_str, delim, 1, LEVEL)>0
         ORDER BY LEVEL ASC;
    begin
         open str_cur;
         loop
         fetch str_cur into mystring;
         exit when str_cur%NOTFOUND;
         dbms_output.put_line ('mystring is '||mystring);
         end loop;
         close str_cur;
    end string_to_tokens;a sample input string would be:
    '22|||1334502 RegXL Ltd|18|10032011|2011|John Joe|2000.00|2000.00'The delimiter would be '|'.
    Thanks in advance for your help.
    Thanks
    Edited by: rsar001 on Oct 26, 2011 7:39 AM
    Edited by: rsar001 on Oct 26, 2011 7:40 AM

    Hi,
    You can do something like this:
    CREATE OR REPLACE procedure string_to_tokens
    (                                  in_str                    IN varchar2,
                                    delim                      IN varchar2,
                        VENDOR_ID               OUT number,
                        CCF_ID                    OUT number,
                        PRR_ID                    OUT number,
                        CON_NAME                 OUT VARCHAR2,
                        CONT_TYPE_ID               OUT number,
                        DEPOSIT_DATE               OUT VARCHAR2,
                        CON_YEAR               OUT VARCHAR2,
                        CHG_NAME               OUT VARCHAR2,
                        CON_AMOUNT               OUT number,
                        TOT_AMOUNT               OUT number,
                        encloser               IN  VARCHAR2     := '"'          -- new argument added
    is
         mystring     VARCHAR2 (32767)     := in_str || delim;     -- Remining text to process
         sub_str          VARCHAR2 (32767);                            -- Nth delimited item
         loop_cntr     PLS_INTEGER          := 0;
         delimiter_pos     PLS_INTEGER          := -1;               -- position of 1st delimiter in remaining text
    begin
         WHILE  delimiter_pos != 0
         AND    loop_cntr     <= 10
         LOOP
             loop_cntr := loop_cntr + 1;
             IF  SUBSTR (mystring, 1, 1) = encloser               -- Changes start here
             THEN       -- Next token is enclosed; next token ends with encloser
              delimiter_pos := INSTR (mystring, encloser, 2);
                 sub_str := SUBSTR ( mystring
                             , 2
                          , delimiter_pos - 2
              mystring := SUBSTR ( mystring
                               , delimiter_pos + 2
             ELSE     -- Usual situation: next token ends with delim
                 delimiter_pos := INSTR (mystring, delim);
                 sub_str := SUBSTR ( mystring
                             , 1
                          , delimiter_pos - 1
              mystring := SUBSTR ( mystring
                               , delimiter_pos + 1
             END IF;
             IF  delimiter_pos > 0
             THEN
                                                 -- Changes end here
              IF    loop_cntr =  1
              THEN
                  vendor_id    := TO_NUMBER (sub_str);
              ELSIF loop_cntr =  2
              THEN
                  ccf_id       := TO_NUMBER (sub_str);
              ELSIF loop_cntr =  3
              THEN
                  prr_id       := TO_NUMBER (sub_str);
              ELSIF loop_cntr =  4
              THEN
                  con_name     :=            sub_str;
              ELSIF loop_cntr =  5
              THEN
                  cont_type_id  := TO_NUMBER (sub_str);
              ELSIF loop_cntr =  6
              THEN
                  deposit_date  := TO_NUMBER (sub_str);     -- Should this be a DATE, rather than a NUMBER?
              ELSIF loop_cntr =  7
              THEN
                  con_year     :=            sub_str;
              ELSIF loop_cntr =  8
              THEN
                  chg_name     :=            sub_str;
              ELSIF loop_cntr =  9
              THEN
                  con_amount   := TO_NUMBER (sub_str);
              ELSIF loop_cntr = 10
              THEN
                  tot_amount   := TO_NUMBER (sub_str);
              END IF;
             END IF;
         END LOOP;
    end string_to_tokens;
    {code}
    I added an optional argument after tot_amount, and changed a few lines of code at the beginning of the loop.  The rest of the procedure is unchanged.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Procedure help (urgent)

    i AM NEW TO ORACLE
    I created this procedure
    PROCEDURE P_SUPLR IS
    SUPPLIER VARCHAR2(2000);
    cursor c1 is SELECT DISTINCT(M.SPLR)supplier FROM DM_MARKETING M
    WHERE M.SPLR IN ('ZEG','ZUS','USK');
    BEGIN
         for rec in c1 loop
    supplier := rec.supplier;
    end loop;
    Dbms_out.put_line(supplier);
    END;
    But the output is getting only 'ZUS'
    BUT I NEED TO GET OUTPUT FOR SUPPLIER IS
    'ZEG',ZUS','USK'
    CAN ANYBODY MODIFY THE CODE AND HELP ME PLEASE
    ITS URGENT
    Thanks in advance

    You just need to change the dbms_output.put_line position so that it is inside the loop. If you have a large number of values to display on screen, it may be worth doing SET SERVEROUTPUT ON SIZE 500000 in SQLPLUS before you execute the procedure....
    PROCEDURE P_SUPLR IS
         SUPPLIER VARCHAR2(2000);
         cursor c1 is SELECT DISTINCT(M.SPLR)supplier FROM    DM_MARKETING M
        WHERE M.SPLR IN ('ZEG','ZUS','USK');
    BEGIN
       for rec in c1 loop
          supplier := rec.supplier;
          Dbms_output.put_line(supplier);
       end loop;
    END;HTH
    David

  • Procedure help for loading tables

    I am trying to load data from one table to another eg Table A to Table B
    I would like the procedure to load all data that has been updated or inserted since last load and delete any rows that have not been
    updated since the last load. Can anyone help me please with a procedure for this.
    Thanks in advance.

    Truncate table B then run something similar to:
    DECLARE
    -- Assuming you are running this daily and
    -- the last_update_date column is populated on every insert/update
    CURSOR cura is
    SELECT *
    FROM tablea
    WHERE trunc(last_update_date) = trunc(sysdate);
    -- If you run it at a standard interval then
    CURSOR cura is
    SELECT *
    FROM tablea
    WHERE trunc(last_update_date) BETWEEN trunc(sysdate - n) AND TRUNC(sysdate);
    -- n is the number of days between runs
    tabb_rowid ROWID;
    BEGIN
       FOR arec in cura LOOP
          BEGIN
             SELECT rowid INTO tabb_rowid
             FROM tableb
             WHERE pk_field1 = arec.pk_field1 and
                   pk_field2 = arec.pk_field2;
             UPDATE tableb
             SET pk_field1 = arec.pk_field1,
                 pk_field2 = arec.pk_field2,
                 field3 = arec.field3,
                 field4 = arec.field4
             WHERE rowid = tabb_rowid;
          EXCEPTION WHEN NO_DATA_FOUND THEN
             INSERT INTO tableb
             VALUES (arec.pk_field1,arec.pk_field2,arec.field3,arec.field4);
          END;
       END LOOP;
       COMMIT;
    END;

  • Oracle procedure help

    I have table which has 4 cloums, I would like to write procedure
    Type varchar2(10)
    start Date date
    end date date
    new_news varchar2(100)
    FOR START DATE
    Type =A OR B . whatever start-date user type, save as the sunday before (if it is not already a suday)
    but if type = C or D, use what ever date user types in
    FOR END DAEE
    Type =A OR B . whatever start-date user type, save as the sunday before (if it is not already a suday)
    but if type = C or D, use what ever date user types in
    new_news
    if type = A OR B no new_news entry should be allowed
    if type=C or D new_news hader can be type in
    I need help on writting procedure.

    SQL> SELECT sysdate today, NEXT_DAY(sysdate - 7,'Sun') last_sunday,
      2         NEXT_DAY(TO_DATE('03-Jul-2005','dd-Mon-yyyy') - 7,'Sun') keep_sun
      3  FROM dual;
    TODAY                 LAST_SUNDAY           KEEP_SUN
    Monday    04-Jul-2005 Sunday    03-Jul-2005 Sunday    03-Jul-2005TTFN
    John

  • Cursors & procedures - - Help in simple query!

    hi all...
    i am having difficulties trying to implement a simple
    PL/SQL program, in fact...
    i got it working, but i believe it could be implemented
    in a more procedural manner!!!
    here is my working code:
    CREATE VIEW Todays_Rank AS
    Select ISBN, RANK()OVER (Order by Total_Sold ASC)Sales_Rank
    FROM
    (SELECT bk.ISBN, sum(cc.Quantity) Total_Sold
    FROM Book bk, Cart_Contains cc, Shopping_Cart sc
    WHERE bk.ISBN = cc.ISBN
    AND cc.Cartid = sc.Cartid
    AND ((sc.State='checked-out') Or (sc.State='fulfilled '))
    Group by bk.ISBN
    Order by sum(cc.Quantity) ASC);
    SET serveroutput ON
    BEGIN
    DECLARE
    CURSOR rank_cursor IS
    SELECT ISBN, sales_rank FROM todays_rank;
    IndRec rank_cursor%ROWTYPE;
    BEGIN
    OPEN rank_cursor;
    LOOP
    FETCH rank_cursor INTO IndRec;
    EXIT WHEN rank_cursor%NOTFOUND;
    UPDATE book bk
    SET bk.sales_rank=IndRec.sales_rank
    WHERE bk.isbn=IndRec.ISBN;
    COMMIT;
    END LOOP;
    CLOSE rank_cursor;
    END;
    END;
    as i understood from cursors so far, is that they do the same job as views, which made me think that there must be
    a better implementation for the code above!!!
    *note that the query above is meant to update the book
    table directly, and after it is done, it deletes any
    temporary values, i.e. the created views!!!
    the part to deal with deleting the views is not
    implemented yet though!!
    i hope you have some hints for me...!!!
    thanking your kind attention & cooperation in advance!!

    hi all once again..
    in relation to the same db schema brought up earlier,
    a simple prog. has been implemented to run on daily basis,
    checks all the books that has been ordered by the customers, and that applies on books that are in status
    checked out, and compares the quantity of each ordered
    book to the one held in stock!!
    finally it generates a report of the ordered quantity by customers - quantity in stock * 5
    the query is perfectly working as follow:
    -- Retreival of quantity of books sold today
    CREATE or replace VIEW sold_today AS
    SELECT cc.ISBN, sum(cc.Quantity) AS total_sold
    FROM Cart_Contains cc, Shopping_Cart shc
    WHERE cc.Cartid = shc.Cartid
    GROUP BY cc.ISBN
    ORDER BY Sum(cc.quantity) DESC;
    -- Retreival of the quantity in stock of each book
    CREATE or replace VIEW stock_quantity AS
    SELECT s.ISBN, sum(s.Quantity) AS total_stock
    FROM stocks s
    GROUP BY s.ISBN
    ORDER BY Sum(s.quantity) DESC;
    set serveroutput on
    BEGIN
    DECLARE
    reOrder Number(4);
    todaysDate SHOPPING_CART.ORDER_DATE%TYPE;
    UnknownSoldType exception;
    -- Combining outcome from the two views in a single cursor
    cursor sold_cursor is
    SELECT bk.ISBN, bk.Title, bk.Publisher_Name, st.total_sold, sq.total_stock, shc.Order_date
    FROM sold_today st, stock_quantity sq, shopping_cart shc, cart_contains cc, book bk
    WHERE bk.ISBN = st.ISBN
    AND st.ISBN = sq.ISBN
    AND sq.ISBN = cc.ISBN
    AND cc.Cartid = shc.Cartid
    AND (shc.State='checked-out');
    IndRec sold_cursor%ROWTYPE;
    BEGIN
    -- Todays date
    select distinct sysdate INTO todaysDate from dual;
    -- Printing reoprt's headder
    dbms_output.put_line('====================================='||'=========================================');
    dbms_output.put_line('|| ISBN | Title | Publisher | QUANTIY | QUANTITY ||');
    dbms_output.put_line('|| | | | ORDERS | PURCHASE ||');
    OPEN sold_cursor;
    LOOP
    FETCH sold_cursor INTO IndRec;
    EXIT WHEN sold_cursor%NOTFOUND;
    -- Date checking vs. stock quantity
                   IF to_char(IndRec.order_date, 'ddmmyyyy') = to_char(todaysDate, 'ddmmyyyy') THEN
                        IF IndRec.total_sold > IndRec.total_stock THEN
                        -- Printing orders' report content!
    dbms_output.put_line('====================================='||'=========================================');
    reOrder := (IndRec.total_sold - IndRec.total_stock)*5;
    dbms_output.put_line(' || ' || Lpad(IndRec.ISBN,10,10) || ' | ' ||Lpad(IndRec.Title,20,20) || ' | ' || Lpad(IndRec.Publisher_Name,10,10 )||' | ' ||to_Char(IndRec.total_sold, '9999') || ' | ' || to_Char(reOrder, '9999')|| ' ||');
                        END IF;
                   END IF;
              END LOOP;
              CLOSE sold_cursor;
         dbms_output.put_line('====================================='||'=========================================');
              EXCEPTION
              when UnknownSoldType then
                   dbms_output.put_line('=======================');
                   dbms_output.put_line('ERROR: Aborting program.');
                   dbms_output.put_line('Unknown Pay Type for Name');
              when others then
                   dbms_output.put_line('ERROR During Processing. See the DBA.');
    END;
    END;
    but this raises up my previous question: what is the
    alternative for views, if there is a better one!
    another question, if views is the best alternative in this case, is it possible to delete the temporary
    tables created by views in each case???
    thanking and apprecuiating your help & attention...
    cheers..
    k.s.

  • Procedure Help Please

    I am creating an apex app as part of a personal project and am a bit stuck.
    I have created 2 procedures but I can't figure out how to make them run at the same time, I would ideally like to put them into one single procedure, but every time I try I end up with error warnings.
    the procedures I have are as follows:
    PROCEDURE 1
    CREATE OR REPLACE PROCEDURE upload_new_image
      (p_filename IN VARCHAR2)
    IS
      l_upload_size   INTEGER;
      l_upload_blob   BLOB;
      l_image_id      NUMBER;
      l_image         ORDSYS.ORDImage;
    BEGIN
        -- Get the length, MIME type and the BLOB of the new image from the
        -- upload table. apex_application_files is a synonym for WWV_FLOW_FILES
      SELECT doc_size,
             blob_content
      INTO   l_upload_size,
             l_upload_blob
      FROM apex_application_files
      WHERE name = p_filename;
      -- Insert a new row into the table, returning the newly allocated sequence
      -- number from seq_image_id
      INSERT INTO images
       image_id,
       filename,
       image
      VALUES
       seq_image_id.nextval,
       p_filename,
       ORDSYS.ORDIMAGE.INIT()
      RETURNING image_id
      INTO l_image_id;
      -- lock the row
      SELECT image
      INTO l_image
      FROM images
      WHERE image_id = l_image_id
      FOR UPDATE;
    -- copy the blob into the ORDImage BLOB container
    DBMS_LOB.COPY( l_image.source.localData, l_upload_blob, l_upload_size );
    l_image.setProperties(); -- just in case
      UPDATE images
      SET image = l_image
      WHERE image_id = l_image_id;
      -- clear from upload table
      DELETE FROM apex_application_files 
      WHERE name = p_filename;
      COMMIT;
      EXCEPTION
      WHEN others
      THEN htp.p(SQLERRM);
    END upload_new_image;PROCEDURE 2
    CREATE OR REPLACE PROCEDURE create_blob_thumbnail (p_image_id IN INTEGER) IS
      l_orig          ORDSYS.ORDImage;
      l_thumb         ORDSYS.ORDImage;
      l_blob_thumb    BLOB;
    BEGIN
      -- lock row
      SELECT image
      INTO l_orig
      FROM images
      WHERE image_id = p_image_id FOR UPDATE;
      l_thumb := ORDSYS.ORDImage.Init();
      dbms_lob.createTemporary(l_thumb.source.localData, true);
      ORDSYS.ORDImage.processCopy(l_orig,
                                  'maxscale=128 128',
                                  l_thumb);
      UPDATE images
      SET thumbnail = l_thumb.source.localData
      WHERE image_id = p_image_id;
      dbms_lob.freeTemporary(l_thumb.source.localData);
      COMMIT;
    END;Any help would be greatly appreciated
    Edited by: BluShadow on 30-Nov-2012 14:45
    added {noformat}{noformat} tags. Please read {message:id=9360002} and learn to do this yourself in future posts                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    974264 wrote:
    I have created 2 procedures but I can't figure out how to make them run at the same timeRunning things in parallel would require setting them running as scheduled jobs so they run in their own transactional sessions. You won't be able to run two procedures in parallel from the same session.
    However you should certainly be able to combine two procedures into one if that is all you require.

  • Audigy 2 Zs Platinum Install Procedure help needed

    Namaste all, this is my first post and I am new to Creative products, as I might be the only person in Nepal with the Platinum package! I have an Intel 95 chipset motherboard with that sucky Realtek soundchip, so my brother gave me this Creative product he got from the USA. It looks grand, but the Quick Start confused me, it says to do the install of hardware and then when Windows finds the new hardware to cancel, and then install the Creative software from CD.
    Well, from expierence with other hardwares this is not so good a procedure, as u get unknown devices if something goes wrong with the software install, and I know the disk is almost 2 years old. So I downloaded all the updates for SB350 on this site (a whooping 85+ megabytes) and my question is this:
    Which software do I install first, the old or the new? And it seems to me it would be better to have drivers there first, or should I not be second guessing the Creative Engineers?
    Can anyone tell me what exactally what to do? There is a ton of softwares in the package I can see, and I am wondering what to do now to prevent problems later.
    Well, thanks and I look forward to hanging out in the forum to learn about my cool new sound package.
    Jigs in Kathmandu

    katman, yes i did, i can bring up mediasource from the creative volume icon in the status bar...player, organizer, Go! and Go! launcher. wow, way too much software...
    So I am hoping the update makes all this stuff look better...does it's The Mediasource Go! is version 2.00.06 with a theme engine of V3.0.37...but the Organizer has an about screen that says Creative Media Source 2.02.05. I can't make sense of this but if I get the latest versions on this system at least I can evaluate and make some intelligent choices before i remove it
    I really don't get the two icons, creative volume and Mediasource gO, on right click they both have almost the same choices!
    Anyway, thanks for your help...what to do next? I am a freak about making sure all the drivers and software are the latest on my machines.
    And now I found a hardware problem - or a user problem - how do you get line in 2 on the front of the dri've to work? Mine does not seem to....
    thanks!
    jigs

  • Procedure - Help needed

    I would like to create a table (I don&#8217;t know the number of columns) whose values have to be picked from all the tables in the user_tables which are like &#8216;LINKED%&#8217; .
    There are around 600-700 tables in the DB whose name is like &#8216;LINKED%&#8217;
    All these table have 5 common cols &#8211; IDENTIFIER,C_NAME,CODE,MEAN,VALIDATEX. In addition to this it has some few other extra cols which are not identical for all these tables. There are tables with only 5cols and also there are tables with 20cols(which includes this 5 common column )(other tables with variable cols but not less than 5common columns)
    I would like create a procedure where I need to create a table in the runtime and populate this new table with values from all the 700 tables. The cols name of the new table will be known only during runtime.
    Kindly help me in this..
    Can I have some ideas how to do this in other ways&#8230;
    Thanks a lot

    set heading off feedback off pagesize 0 linesize 75
    spool sa_test.sql
    declare
    v_table_name VARCHAR2(50);
    v_sql_stmt VARCHAR2(2000);
    v_counter NUMBER;
    CURSOR c1 IS
    SELECT table_name
    FROM user_tables
         WHERE table_name like 'CODED%'
    ORDER BY table_name;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_table_name;
    EXIT WHEN c1%NOTFOUND;
    v_counter := 1;
    IF v_counter = 1 THEN
    v_sql_stmt := 'SELECT * from ' || v_table_name ||';';
    ELSE
    v_sql_stmt := v_table_name ;
    END IF;
    v_counter := v_counter + 1;
    dbms_output.put_line (v_sql_stmt);
    v_sql_stmt := null;
    v_counter := 1;
    END LOOP;
    CLOSE c1;
    END;
    spool off
    @sa_test.sql
    This is sql script I'm using for retriving the values from all the tables .But I'm in need to create a table in a procedure, so that I can integrate the procedure in the Business Objects reports.

  • Stored Procedure Help

    Hi all,
    I need some help in creating a store procedure. My requirement is We are going to upload a EDI file into a table.
    EDI_Test 
    Col1 Row_Data varchar(max)
    Col2 Sort ID Identity
    I parse the EDI file and remove the ~ as line terminator. See Sample data below
    Sample Dummy Data:
    1 ISA*00* *00* *ZZ*617591011AAAA*ZZ*11111111*14333*1117*^*00501*000000001*0*P*
    2 GS*FA*617591011TEDP*645999162*20140226*2107*1*X*00A1
    3 ST*999*0001*005010X231A1
    4 AK1*HC*1253*005010X223A2
    5 AK2*837*01293*005010X223A2
    Once the data is in the table I want to read the file and return the follow
    Lets say
    select row_data from EDI_test where Row_Data like 'AK1*%'
    Returns : AK1*HC*1253* Then I am good but lets say If it returns AK1*CC*1253* Then I need to return a message as
    Reject.
    How can i do this ?
    FM

    This?
    CASE WHEN row_data LIKE '%AK1*HC%' THEN 'Good!'
    WHEN row_data LIKE '%AK1*CC%' THEN 'BAD!'
    ELSE ''
    END

  • Stored procedure help needed please!

    dsds

    hello ive an assignment due but ive hit a brick wall, would anyone be as kind to help me?
    ShareTraders LTD is an online share brokerage which allows its customer to trade shares on the US stock market.  Customers can either sell or buy shares – the sales price depends on the curently quoted prices in the share table.  The below ERD
    shows a section of their database that refers to their customers who trade shares online.
    Funds are categorised into different categories.
    Customers may limit their exposure to a particular category of fund.
    Customers fund their share purchases through funds.
    Customers may limit their exposure to a particular category of fund.
    Shares are grouped into different categories.
    Customer trades are tracked in their portfolios.
    The shares that the customer’s trade are recorded in their portfolios.
    Staff are authorised to change the share prices of particular categories of shares.
    Staff are authorised to change the share prices of particular categories of shares.
    TSQL à Stored procedure
    Create a stored procedure (call it
    Assign1) which will
    insert a purchase of shares into the CustomerPortfolioTBL for a customer. The data that will be passed to the stored procedure is: the CustomerID, the ShareID, and the TransactionAmount.
    The data for the other columns in the CustomerPortfolioTBL will be got as follows
    TransactionID
    à make sure that this column is an identity column which will automatically generate the next TransactionID.
    TransactionType – this column will be filled by your sproc with the word “Purchase”.
    SharePrice
    à the price will be read from the share SellPrice column in the ShareTBl for that ShareID.
    TransactionDate
    à this column will be filled by your sproc with todays date
    à use the GetDate() function.
    Business Requirement
    Customers are not allowed to purchase more than 5 times in the current month. Your sproc must therefore:-
    Count the number of purchases the customer has made this month
    à use the Month() and the GetDate() functions.
    If the no of purchases is greater than or equal to 5 your sproc must send an error message of “Sorry
    purchase is refused 5 purchases have been made this month”
    Customers cannot spend over their exposure limit for a particular share category – get this from the CustomerExposureTBl.  Your sproc must therefore:-
    Read in to an internal variable the exposure limit from the CustomerExposureTBl for the inputted CustomerID.
    Add up all the transaction amount of shares that the customer has purchases (TransactionType = purchase) for shares whose category is the same as the share
    being purchased).  Put this calculation into an internal variable.
    Add up all the transaction amount of shares that the customer has sold  (TransactionType = sale) for shares whose category is the same as the share being
    purchased).  Put this calculation into an internal variable.
    iv) 
    If ((Total Purchases
    of share in this category – Total Sales of share in this category) + TransactionAmount) is greater than  exposure limit your sproc
    must send an error message of “Sorry purchase is refused Exposure limit is breached”
    Tables
    http://tinypic.com/r/2nvqt88/8
    This reads like you just want someone to do your homework for you. Could you post the following?
    What have you written so far? Please include the code in your reply.
    Where are you getting stuck specifically?
    Mark as answer or vote as helpful if you find it useful | Igor

  • Storing the values from a procedure - help required

    Hi All,
    I am having a package which consists of two procedures.
    Both the procedures need to calculate 6 averages of some of my fields based on unique number.
    (These two procedures process different unique numbers).
    Now, as same code is implemented in the two procedures for calculation,
    I want to move the logic into another procedure/function, with IN parameter as the unique number.
    Now how can I get these 6 values from the procedure.
    If I use OUT parameters, how can I get the values inside the procedure.
    Please suggest me a solution.
    Thanks in advance.
    Regards
    Raghunadh

    Example of pipelined function...
    SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
      2  ( col1   VARCHAR2(10),
      3    col2   VARCHAR2(10)
      4  )
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
      2    v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
      3    v_obj myrec := myrec(NULL,NULL);
      4  BEGIN
      5    LOOP
      6      EXIT WHEN v_str IS NULL;
      7      v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
      8      v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
      9      IF INSTR(v_str,',')>0 THEN
    10        v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
    11        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
    12      ELSE
    13        v_obj.col2 := v_str;
    14        v_str := NULL;
    15      END IF;
    16      PIPE ROW (v_obj);
    17    END LOOP;
    18    RETURN;
    19  END;
    20  /
    Function created.
    SQL>
    SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
    Table created.
    SQL>
    SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
    3 rows created.
    SQL>
    SQL> select * from mytab;
    COL1       COL2
    1          2
    2          3
    4          5Although I'm not sure you necessarily need to do it this way. Could you show us the code you are using and more details of what you are trying to do?

  • JDBC Stored procedure help required

    Hi All,
    Please let me know simple blogs how to use JDBC Stored procedure or any other method  in receiver jdbc adapter to insert or select in 2 tables
    Please  let me know simple blogs how to use JDBC Stored procedure or any other method  in sender jdbc adapter to select from 2 tables
    Thanks

    Hi,
    I am also looking for JDBC Stored procedure or any other method in sender jdbc adapter to select data from 2 tables
    Thanks

  • PHP Calling Stored Procedure Help!

    I have been messing with this code for weeks now and read a ton of forums and archives and I can't figure this out for the life of me.... I included the Stored Procedure and the PHP code and the ERROR I am getting below. Someone else in my company wrote the stored procedure. I am running PHP Version 4.3.9
    THANK YOU SO MUCH TO ANYONE IN ADVANCE!
    Oracle Stored Procedure
    Procedure GetDBCodes(appl_type In Varchar2,
    output_array Out str_varray,
    rtn_cd Out Number,
    rtn_errm Out Varchar2,
    rtn_spinfo Out Varchar2) As
    -- Program ID: GetDBCodes
    -- Author: Chris Calder
    -- Date Written: October 5, 2004
    -- System: Engage Thoughtware
    -- Purpose: Get the database codes for the application identified by appl_type
    -- Arguments: IN: appl_type 'ETW' = ThoughtTree
    -- 'ADM' = System Administration
    -- OUT output_array array of fixed length delimited output:
    -- company_name: 1 - 38
    -- user_name: 39 - 48
    -- db_code: 49 - 58
    -- db_version 59 - 66
    -- OUT rtn_cd: SQL return code
    -- OUT rtn_errm: Oracle error message text
    -- OUT rtn_spinfo: debugging info consisting of:
    -- procedure name and input parameter list,
    -- followed by the label of the SQL
    -- statement that caused the exception
    sql_stmt Varchar2(100);
    db_schema_name Varchar2(10);
    company_name Varchar2(40);
    db_version Varchar2(10);
    counter Number Default 0;
    lv_appl_type Varchar2(10);
    stmt_label Varchar2(40);
    data_error Exception;
    Begin
    stmt_label := '<<get_dbcodes>>';
    output_array := str_varray();
    lv_appl_type := appl_type || '%';
    For code_rec In (Select schema_name,
    db_code,
    dblink
    From etw$map.DBCode
    Where (dblink <> 'UTDEV' Or dblink Is Null)
    And schema_name Like lv_appl_type
    Order By substr(schema_name,
    4,
    3))
    Loop
    db_schema_name := 'ETWDB' || substr(code_rec.schema_name,
    4,
    3);
    If code_rec.dblink Is Null Then
    sql_stmt := 'select db_node_name, db_version from ' ||
    db_schema_name || '.masterprofile';
    Else
    sql_stmt := 'select db_node_name, db_version from ' ||
    db_schema_name || '.masterprofile' || '@' ||
    code_rec.dblink;
    End If;
    Execute Immediate sql_stmt
    Into company_name, db_version;
    -- add arrary extend and assignment here
    output_array.Extend;
    counter := counter + 1;
    output_array(counter) := rpad(company_name,
    38,
    ' ') || rpad(code_rec.schema_name,
    10,
    ' ') ||
    rpad(code_rec.db_code,
    10,
    ' ') || db_version;
    End Loop;
    Commit;
    rtn_errm := 'NONE';
    rtn_cd := Sqlcode;
    rtn_spinfo := 'CodeMap.GetDBCodes' || ' successful';
    Exception
    When data_error Then
    Rollback;
    rtn_errm := 'Appl_type value: ' || appl_type || ' is not valid';
    rtn_cd := -999;
    rtn_spinfo := 'CodeMap.GetDBCodes' || ' unsuccessful';
    When Others Then
    --** select from value table failed
    Rollback;
    rtn_errm := Sqlerrm;
    rtn_cd := Sqlcode;
    rtn_spinfo := 'CodeMap.GetDBCodes ' || stmt_label;
    End GetDBCodes;
    PHP Calling the Oracle Stored Procedure
    <?php header("cache-control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache");
    $con = OCILogon('etw$map', 'pam$wte', 'LINUX_CONSONUS');
    $query = "BEGIN codemap.GETDBCODES('ETW',:results,:cd,:errm,:spinfo); END;";
    $stmt = OCIParse($con, $query) or die ('Can not parse query');
    OCIBindByName($stmt,":results", $output_array,-1);
    OCIBindByName($stmt,":cd", $rtn_cd,-1);
    OCIBindByName($stmt,":errm", $rtn_errm,-1);
    OCIBindByName($stmt,":spinfo", $rtn_spinfo,-1);
    OCIExecute($stmt);
    ?>
    ERROR I AM GETTING
    Warning: ociexecute(): OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GETDBCODES' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in c:\inetpub\wwwroot\Projects\PopUpRef\v2\php\testOracle.php on line 17

    Ok so I got the problem fixed,
    one of the output variables coming from the stored procedure was a custom defined object. So I had to use an ocinewcollection and set the typ to the custom type oracle was using and then bind it. So now everything is working great... I just thought I would post this for any one else that runs into this...
    here is my working code:
    <?php header("cache-control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache");
    $con = OCILogon('user', 'pass', 'LINUX_CONSONUS');
    $query = "BEGIN codemap.GETDBCODES('ETW',:output_array,:cd,:errm,:spinfo); END;";
    $stmt = OCIParse($con, $query) or die ('Can not parse query');
    $output_array = ocinewcollection($con,"STR_VARRAY");
    OCIBindByName($stmt,":output_array", $output_array,5000,OCI_B_SQLT_NTY);
    OCIBindByName($stmt,":cd", $rtn_cd,6);
    OCIBindByName($stmt,":errm", $rtn_errm,200);
    OCIBindByName($stmt,":spinfo", $rtn_spinfo,200);
    OCIExecute($stmt);
    ?>
    So everything is working great. but I do have another question now how do I get data out of the ocinewcollection object?

Maybe you are looking for

  • Monitor compatibility issue syncmaster

    To whom it may concern, I have the following problem with my Macbook. I used to use my Samsung Syncmaster 2243BW monitor as an extra display connected to my macbook. It used to work fine with Leopard 10.5, but since the SnowLeopard came out it doesn'

  • XML document structures must start and end within the same entity

    Hi there, I'm working with a client/server application and using SaxParser for reading in xml. I get the SaxParserException: XML document structures must start and end within the same entity. I understand what that means, but it isn't applicable! The

  • Problem with Batch Updates

    Hi All, I have a requirement where in I have to use batch updates. But if there's a problem in one of the updates, I want the rest of the updates to ingore this and continue with the next statement in the batch. Is this not one of the features in Bat

  • My playlists wont sync with my iPhone 5

    I've deleted my playlists and rebuilt them, I've reboot both my iPhone and Mac, I've deleted my music from my phone, and I've tried remapping iTunes.  What else do I need to do.  I've never had this issue before.  iOS7 is horrible!

  • OM : Retrive employees Division Wise .

    Hi all, If a higher official(Heads and Above) runs the report i hav to show the authorized DIVISION & DEPARTMENT which can be controlled by him. And from the DIVISION & DEPARTMENT selection, he needs to fetch all the employees belonging to the select