Stored precedure

Hi
My client has approval procedures associated with profit centres so when a user selects a certain profit centre it triggers
an approval template. In some instances the purchase order triggers more than one approval template like when certain GL accounts are used.
Users are linked to one or more profit centres on the employee master - membership tab where the Role is 'Purchasing' and the profit centres listed as 'Teams' .
The problem is that when the user select  a profit centre not associated with them  it bypasses the approval process since the queries used to trigger the apprval template, refers to a certain profit centre:
SELECT Distinct 'True' FROM OPOR T0 where
$[OPOR.U_XTBI_APP] = 'HOS'
The value 'HOS' in this UDF is populated via an addon which takes the value from the line(s) of the PO. If > 1 profit centre is used the value is 'MultipleCC" in which case always goes to a certain manager as per the associated approval template.
I need to block a user from selecting an incorrect profit centre when posting a purchase order but the script I have for this in the approval notification does not work properly. When I do get it to give the user a red line - this comes after the approval process and the document goes into draft mode with it's status as 'Suspended'.
If @object_type = '22'
begin
if(select top 1 OcrCode from POR1 where DocEntry = @list_of_cols_val_tab_del)
not in
(select [Name] from OHTM
     where teamid in
     (select teamid from HTM1 where empid =
          (select Empid from OHEM where UserID =                          (select Usersign from OPOR where Docentry = @list_of_cols_val_tab_del ))))
          and
          len((select top 1 OcrCode from POR1 where DocEntry = @list_of_cols_val_tab_del)) = 0
     begin
          set @error = 1
          set @error_message = (select top 1 OcrCode from POR1 where DocEntry = @list_of_cols_val_tab_del)
     end
end
I'll appreciate it if someone can help me with this code - it must be able to look at multiple lines.
Regards
Danie

Hellow Sun
What do u mean "Best Production" ??
If you mean best program is best for developing stored procedures from Oracle, Then it is "Procedure Builder".
Other Third party Tools are like ToAD 6.5
Visit thier site at http://www.Quest.com
and Download a demo.
Regards
Tariq

Similar Messages

  • Error in Simple Stored Precedure!!

    Hi Folks,
    I am new to oracle...At present i'm working in MS SQL Server...I am trying to write a small stored procedure which retrieves a result set(ie rows) from a given table in Oracle 8i.I have written a procedure as
    create procedure test is
    begin
    select * from stu;
    end
    and I executed the above procedure.It was showing Procedure created with compilation errors.What would be the problem?.Same procedure is executing with out any errors in SQL Server.
    Can anyone pls give me a solution for this?.
    Thanks in advance,
    Murali

    Murali,
    I answered a question just like this a little while ago. I programmed TSQL for about 5 years and yes it would be nice if PL/SQL could return a data stream, but it doesn't. However as I explain below I use a method I like even better, since I would rather have an object (a view) that I can get this data from anyway. Do remeber a function can return a data stream though so you might want to consider that as well. Anyway this is what I had said ...
    --[START NOTE]
    I've run into this problem allot with Oracle. If I was to point out the biggest difference between PL/SQL and TSQL it is this ability your wanting, to have a data stream come back from a oracle function/proc/package. In TSQL you can make a proc that simply says, SELECT * from T1, and when you execute this, you get a data stream back. Oracle does not do this, but there is a flip side. There is a different approach I've realized to this and I would NOT use this data return stream ability even if it was supported. This is what I usually do when I want data from a package ...
    Use a VIEW.
    Call a procedure that creates a database VIEW of the SELECT query you want. (you will have to remember the name of the view) , Then simply do SELECT * FROM <view name you made>. Doing it in this fashion allows so many more abilities than just getting a data set back. Your data set is now an object which you can query over again and even other sessions have access to it. See the basic example below ...
    SQL> create or replace PROCEDURE sp_sql (ps_in_sql in varchar2)
    2 as
    3 ls_sql varchar2(2000) := upper(trim(ps_in_sql));
    4 BEGIN
    5 execute immediate ls_sql;
    6 end sp_sql;
    7 /
    Procedure created.
    SQL> show errors
    No errors.
    SQL>
    SQL> execute sp_sql('create or replace view v1 (N1) as select distinct t1.n1 from t1 order by t1.n1'
    PL/SQL procedure successfully completed.
    SQL> select * from v1;
    N1
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    10 rows selected.
    This is just the basic principle to get a data stream back from running a single execute command, with one additional SELECT * from VIEW. The main way I use this ability is just passing the WHERE clause and recompile the view inside the procedure, since I may want a date range, an IN clause, other criteria, but in the end I just do 1 EXECUTE and SELECT * from VIEW.
    This method is better that just trying to get a proc to return a data stream. Make the proc create an object that you can bind to with active objects (like grids, drop down boxes, etc.), and after you now have the view to even do more complex SQL on, since you CANT query your data stream to get only the 'JOHN DOE' entries back.
    Anyway I hope this helps a little, try it and you'll find this works very well.
    Tyler.
    --[END NOTE]

  • Web Services for Oracle 8i

    Is there any means for the Oracle 8i Platform to implement a Webservice to
    access Business Logic in stored precedures?
    We were evaluating IONA's XML Collaboration Suite and their Oracle Adaptor
    but we are not satisfied with the level of control the adaptor provides.
    Do you have any suggestions?
    Best regards,
    Andreas

    Yes, you can publish stored procedures as Web services. Two approaches:
    1. Check out the new Web services sample that came out the other day, example two where SQLJ is used to wrap a Java class as a stored procedure, the connection is then wired into the generated class and finally it is published as a Java Web service using Oracle9i JDeveloper 9.0.2. See:
    http://otn.oracle.com/sample_code/tech/java/web_services/
    and look at the Tax Calculator viewlet/code.
    2. This is essentially the same way that the OC4J PL/SQL Web service samples work too (using SQLJ to generate a Java PL/SQL proxy), but the OC4J sample (url below), provides a more parametric way to pass the connection information to the proxy by using a parameter in the web.xml file. Check out:
    http://download.oracle.com/otn/java/oc4j/how-to-web-services.zip
    See the readme and work with the sample in plsqlws.zip
    This one is a both better and worse from a developers perspective compared to the first Oracle9i Jdeveloper oriented example. The good part, depending on your perspective, is that it is all command line based (some people like this, some people don't) and uses the longer term approach to publishing stored procedures as Web services for Oracle9iAS with the parameters passed in via the web.xml. The bad part is the example is a little hard to follow because many of the pieces are already created for you rather than explaining how they were created. The first example at least shows pretty much all the steps but doesn't quite elegantly solve the connection problem that the OC4J sample does.
    In July/August, Oracle9i JDeveloper will be updated to publish stored procedures using the Oracle9iAS infrastructure (basically the web.xml fix) ... although once you understand it, it is fairly easy to manually do it inside of JDeveloper.
    Hope this gets you going.
    Mike.

  • Can't turn off bdump logging

    hi!
    My database has a few PL/SQL and Java Stored Precedures. Everytime I start those procedures I get a massive logging in the bdump directory (about 87GB within a few days).
    I remember I played around with 10046 Event logging a few weeks ago, but I don't think thats the reason because I did a "ALTER SYSTEM SET EVENTS '10046 TRACE NAME CONTEXT off';" without any luck.
    The content of the logfile look like
    WAIT #7: nam='db file scattered read' ela= 392 file#=18 block#=289826 blocks=32 obj#=54178 tim=1115053300645500
    WAIT #7: nam='db file scattered read' ela= 351 file#=18 block#=289858 blocks=32 obj#=54178 tim=1115053300646476
    WAIT #7: nam='db file scattered read' ela= 357 file#=18 block#=290697 blocks=32 obj#=54178 tim=1115053300657346
    WAIT #7: nam='db file scattered read' ela= 355 file#=18 block#=290729 blocks=32 obj#=54178 tim=1115053300658320
    FETCH #7:c=3741432,e=3702526,p=116352,cr=123834,cu=0,mis=0,r=1,dep=2,og=1,tim=1115053300665902
    WAIT #8: nam='SQL*Net message to dblink' ela= 4 driver id=0 #bytes=1 p3=0 obj#=54178 tim=1115053300666311
    WAIT #8: nam='SQL*Net message from dblink' ela= 833 driver id=0 #bytes=1 p3=0 obj#=54178 tim=1115053300667202
    WAIT #8: nam='SQL*Net message to dblink' ela= 3 driver id=0 #bytes=1 p3=0 obj#=54178 tim=1115053300667299
    ....How can I find out how to turn off these massive logging?
    michi

    session# ?? don't you mean serial#?
    but anyway. within the last two hours I got 220 new .trc files in bdump. Disable it for each in not the solution. The filesname are like
    tadev_s003_20273.trc
    tadev_s003_21362.trc
    tadev_s003_21429.trc
    tadev_s004_23101.trc
    (tadev is my database-name)
    It looks like the problem is that every new session is logged by default. I've already restartet the DB (its a development-server) after altering the system with 'ALTER SYSTEM SET EVENTS '10046 TRACE NAME CONTEXT off';", so every session was started after turning 10046 off. So I think its not 10046-logging.
    Any ideas?

  • Thinking of pre installation and post installation

    Hi,
    I understand the following is very common question, but I need to know the answer specific to my case.
    my case:
    My production database has around 100 tables in a single database/instance (no clusterred yet); 3 of tables are growiing very fast, in less than 1 month can use more than 1TB hard disk space, and we have to keep 6 months' data (so in a half year, disk space will be used up 6-10 TB by these 3 tables; every day there are lots of operations on these tables, update, insert and query (no delete, every operation invoked heavy API stored precedure.
    questions.
    1. if applying cluster, installing in 2 nodes, 5 nodes, 10 nodes, can I expect linear performance increasing to 15%,18%,20%?
    2. install nodes in one physical box (usiing vmware) better or 1 node 1 box better, in terms of performance?
    3. afer installing Grid, the database install in one of those node or iin another box?
    4. any doc telling how to install/configure the database upon cluster/nodes?
    Thanks
    John

    992202 wrote:
    Firstly install nodes, to be able to build up a cluster, on top of it, install multiple database instances, then we can configure a RAC database, which will still look like a single database from external client point of view.Correct. Grid installation first to build the cluster. Then RAC installation to provide a cluster database infrastructure across grid nodes. Then create a physical cluster database with a database engine on each cluster node.
    now going to the point how I think and expect performance increasing against my case.
    without clustered database (say in a standalone or singleton instance), executing 100 database operation (query, insert, update, by calling API, stored procedures) takes 5 minute; now in RAC database in which 5 nodes, 5 database instances in 5 physical machines, 100 operation may distribute to all nodes, namely each database instance may just need to handle 20 request (ideally); this way performance should be increased lots.Emphasis on should.
    Yes, RAC provides for scalability. However, no cluster (RAC and anything else) is capable of simply taking any program (or stored procedure), and make that now run faster across multiple cluster nodes.
    The program (stored proc or SQL in RAC's case) need to be able to run in parallel, deal with concurrency, and do this in a thread-safe way. The cluster provides the tools for this. The program needs to support or use these tools.
    And, I also think, in 10 nodes cluster, it's better that installs 10 database instances than installing only 5, in terms of performance.Of course, you want to use all cluster nodes. But you can for example create server pools in the cluster and more than one cluster database - and run these on your cluster. A cluster does not necessarily mean only supporting a single cluster database.
    A report shows CPU usage is very high constantly during executing (now we use 32 CPU in one box), however I/O and network usages look normal.Unlikely that a RAC will do better in this case - running processes within the same h/w boundary on 32 CPUs will usually be faster than running the same processing across 16 server nodes, with 2 CPUs per server.
    Can I still expect linear performance increasing? if no, what can RAC database help me out, or any other way can help me my case?As I said - RAC provides incredible scalability (e.g. my biggest RAC does up to 35,000 rows inserts per second, and uses parallel processing to process 30+ million row data sets using several table joins in less than 120 seconds).
    But for any cluster - scalability needs to be part and parcel of the software loads run on that cluster. If the workload of the software cannot be parallelised, if workloads are not designed to be scalable, then no amount of clustering will improve the runtimes of such workloads.
    My suggestion is to first identify the CPU related performance problem you have. You need to know WHAT the problem is, in order to decide on how to address it. And whether RAC is a solution to the performance problem.

  • Fast speed TTL signal sampling

    Hi,
    I am a beginner of Labview. Currently we are facing a new project that i believe fast data acquisition is the key point. If someone could give some guidance I would be greatly appreciated.
    Board: AT-MIO-16E1
    Signals: A series of TTL signals generated by an avalanche photodiode, 30 nanoseconds in width, the frequency of the occurence of signals could be as high as 10MHz.
    Objective: Counting the number of TTL signals during a certain period of time, (form microseconds to milliseconds) store it somewhere, and repeat the counting and storing precedure for lots of cycles as many as the hardware allows.
    Questions:
    1. Is this a project for the board and Labview software?
    2. As we imaging, there will be some deadtime tween th
    e periods that the signals are being counted. Could we minimize the deadtime to a insignifcant value? (like 5% of the counting time?)
    3. If it could be done by Labview, is there any additioal hardware we need to purchase? E.g. a board that provides gating signals.
    4. Is there any exsisting examples we can copy?
    Thank you,
    Gufeng

    Being a long time user of the E1 boards myself, I would say that you MAY be able to do this. As I don't have the specs handy right now, I can suggest a means by which to come up with the solution for yourself:
    Check the specs of the board. You are looking for the specs for the DAQ STC timer portion, as you want to do counting operations, not data acquisition. I don't remember if the DAQ STC on the E1 can handle 10MHz. If it doesn't, stop there, and get your NI Catalog and look for one of the newer boards with the advanced timing chips, I believe these can handle it. If the E1 can handle it, go on from there. Create a timing diagram for yourself, to get a visual picture of what you need. Then determine what gating and triggering you need. There are numerous
    examples in the sample programs database in LabVIEW for counting. These should point you in the right direction.
    Good luck

  • Calling a pl\sql package main precedure from a SHL script

    If I run this procedure from TOAD suppl_load_main MY package is executed,
    I need to be able to handle this to the user, so they can run it from our application, I am using a shl script to call this precedure, I done this before and it works, I never done using the main precedure from a package where the main call other precedures, I know I am doing the right stuff in the application registering the
    jobs, creating the links for the shl etc...
    I guess the question is, it is possible to call the Main precedure(that call other precedures) from the shl script, or what I am doing wrong
    Thank you
    PROCEDURE suppl_load_main (
          p_one_up_number     IN   NUMBER,
          p_process_name      IN   VARCHAR2,
          p_audit_or_update   IN   VARCHAR2,
          p_user              IN   VARCHAR2 DEFAULT NULL
       IS
          Modification History
          08/11/2009 Creator:
          This is the precedure that will execute the all package, there are not parameters,
          the package just need to be executed from this precedure.
          Changes:
          p_applicant_main_err_code   VARCHAR2 (2000);
          p_main_err_code             NUMBER;
          p_ora_err_msg               VARCHAR2 (2000);
          p_insert_err_code           VARCHAR2 (2000);
          p_ora_err_code              VARCHAR2 (2000);
          p_srtpers_err_code          VARCHAR2 (2000);
          p_gurmail_err_code          VARCHAR2 (2000);
          v_out_path                  VARCHAR2 (2000)               := 'MIDD_LOG';
          v_out_file                  VARCHAR2 (2000)
             :=    'common_app_supl_load_pkg'
                || '_'
                || TO_CHAR (SYSDATE, 'YYYYMMDDHH');
          v_file_handle               UTL_FILE.file_type;
          p_refresh_err_code          VARCHAR2 (20000);
          v_email                     saturn_midd.mail.email_con;
          v_mailto                    saturn_midd.mail.email_address;
          v_mailfrom                  saturn_midd.mail.email_address;
          v_mailsubject               VARCHAR2 (65)                  := '';
          v_mailmessage               VARCHAR2 (32000)               := '';
          v_database_name             VARCHAR2 (10);
       BEGIN
          SELECT ora_database_name
            INTO v_database_name
            FROM DUAL;
          v_database_name :=
                  SUBSTR (ora_database_name, 1, INSTR (ora_database_name, '.') - 1);
          -- isolate instance name
          v_file_handle := UTL_FILE.fopen (v_out_path, v_out_file, 'w');
          UTL_FILE.put_line (v_file_handle, v_database_name);
          UTL_FILE.put_line (v_file_handle,
                             ' ' || TO_CHAR (SYSDATE, 'DD-MON-YYYY HH:MI:SS')
          UTL_FILE.put_line (v_file_handle, 'Starting the stuu_MISS_LOAD_main...');
          srtiden_insert (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
          srtaddr_insert (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
          srtpers_insert (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
          upd_srtpers_day_mon_yr (p_srtpers_err_code,
                                  p_ora_err_code,
                                  p_ora_err_msg
          srttele_home (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
          appl_gurmail_insert (p_gurmail_err_code, p_ora_err_code, p_ora_err_msg);
          p_main_err_code := '0';
          UTL_FILE.put_line (v_file_handle,
                             CHR (10) || 'All procedures ended successfully.'
          IF p_applicant_main_err_code = 0
          THEN
             UTL_FILE.fremove (v_out_path, v_out_file);
          END IF;
          v_mailto.email := '[email protected]';
          v_mailfrom.email := '[email protected]';
          v_mailsubject :=
                  v_database_name || ': common_app_supl_load_pkg,testing email_1 ';
          saturn_midd.mail.MESSAGE
                                 (v_email,
                                  v_mailto,
                                  v_mailfrom,
                                  v_mailsubject,
                                     v_database_name
                                  || ': *common_app_supl_load_pkg testing email* '
                                  || CHR (100)
                                  || 'All procedures ended successfully: '
                                  || v_out_path
                                  || '/'
                                  || v_out_file
       EXCEPTION
          WHEN OTHERS
          THEN
             p_applicant_main_err_code := '1';
             p_ora_err_msg := SUBSTR (SQLERRM, 1, 2000);
             p_ora_err_code := SQLCODE;
             v_mailto.email := '[email protected]';
             v_mailfrom.email := '[email protected]';
             v_mailsubject := v_database_name || ': commonapp_supl_load_pkg';
             saturn_midd.mail.MESSAGE
                         (v_email,
                          v_mailto,
                          v_mailfrom,
                          v_mailsubject,
                             v_database_name
                          || ': *commonapp_supl_load_pkg ended testing email_2* '
                          || CHR (100)
                          || 'Output log is on the server MIDD_LOG: '
                          || v_out_path
                          || '/'
                          || v_out_file
             saturn_midd.mail.message_end (v_email);
       END suppl_load_main;
    END commonapp_supl_load_pkg;here is the shl
    v_audit_or_update VARCHAR (1) := 'A';
    The application needs this parameter...
    /* Formatted on 2009/02/06 15:17 (Formatter Plus v4.8.8) */
    --   Author:       
    --   Date Written: August 2009
    --   Purpose:  This script calls the PROCEDURE saturn_midd. suppl_load_main
    --  Version Control:
    SET serveroutput ON SIZE 1000000
    DECLARE
       v_audit_or_update   VARCHAR (1)                      := 'A';
       job_num             NUMBER                           := NULL;
       process_name        VARCHAR2 (8)                     := NULL;
       v_user              VARCHAR2 (30)                    := NULL;
    BEGIN
       job_num := TO_NUMBER (&1);
       process_name := '&2';
       v_user := UPPER ('&3');
       -- Retrieve the parameters for this job submission, so they can be passed to
       -- the stored procedure.
       SELECT UPPER (gjbprun_value)
         INTO v_audit_or_update
         FROM general.gjbprun
        WHERE gjbprun_job = UPPER (process_name)
          AND gjbprun_one_up_no = TO_NUMBER (job_num)
          AND gjbprun_number = '01';
       -- Now call the stored procedure to do the work.
    saturn_midd.commonapp_supl_load_pkg.suppl_load_main( job_num,
                                                          process_name,
                                                          v_audit_or_update,
                                                          v_user);
    EXCEPTION
       WHEN NO_DATA_FOUND
       THEN
          -- Put a message in the job log
          DBMS_OUTPUT.put_line
                        ('No parameters in Process Run Parameter Table (GJBPRUN)');
    END;
    EXIT;
    /

    what I am doing wrong supl_load_main invokes a whole bunch of commands that could each potentially fail, but it has one generic exception handler that sends an email (or that's what it looks like, maybe it desn't even do that - what do saturn_midd.mail.MESSAGE and saturn_midd.mail.message_end do?) and doesn't re-raise the exception, so anything could be failing and you wouldn't know.
    There seems to be some confusion between "p_" variables (normally parameters) and "v_" (normally local variables) which suggests that some wholesale copying and pasting might have gone on and therefore that some of the assignments might not be doing what they were originally intended for. For example, after assigning SUBSTR (SQLERRM, 1, 2000) to p_ora_err_msg, it is not used again. Perhaps originally p_ora_err_msg was returned to the caller, written to a logfile etc.
    I'm not a fan of including the word "main" in procedure names or the assumption that one procedure in a package should be more important than any others, but I do see it a lot so I guess you're not alone in that approach.

  • I am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier

    i am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier photo please help me to recover my photos

    Well I'll guess you're using iPhoto 11:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • If statement in stored proc

    hi
    i have stored proc like this
    ALTER PROCEDURE [dbo].[p_member]
    @MemberID INT = NULL,
    @ID INT = NULL,
    @Type varchar(20) = NULL
    AS
    IF NOT EXISTS (SELECT Memberid FROM Member mcd  JOIN Pro p WITH(NOLOCK)
                   on mcd.ProgramID = p.ProgramID WHERE ((mcd.MemberID = @MemberID) OR (mcd.ID = @ID and p.CD = @Type)))
    BEGIN
               select 'CAN''T BE FOUND'
    END
    i am not sure what i am doing in if statement, its not working.my logic should be like 
    check if atleast on or the other is available ..ie memberid or id+type, if nto i need to print  message.
    thanks

    What do you get for the following:
    DECLARE @MemberID INT = 444,
    @ID INT = NULL,
    @Type varchar(20) = NULL;
    IF NOT EXISTS (SELECT Memberid FROM Member mcd JOIN Pro p WITH(NOLOCK)
    on mcd.ProgramID = p.ProgramID WHERE ((mcd.MemberID = @MemberID) OR (mcd.ID = @ID and p.CD = @Type)))
    BEGIN
    select 'CAN''T BE FOUND'
    END
    ELSE SELECT 'FOUND'
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Excel Workbook with Excel Data Model stored on SharePoint - daily refresh

    I'm not sure if this is exactly the right forum but I'm hoping that someone here can either answer or point me in the right direction.
    I have an Excel Workbook with an Excel Data Model.
    The Excel Data Model uses SQL to contact our data warehouse and pull through data into tables.
    We are storing the Workbook on a SharePoint site and viewing it using Excel Services.
    The data in our data warehouse is updated daily and so I would like to refresh the workbook daily and remove the option to refresh the data in the browser.
    Is this possible with a workbook that has an Excel Data Model (I've seen lots of posts that relate to workbooks with connections to tabular models).
    Thanks
    Paul

    Hi Paul,
    I have answered this issue in this thread that you posted in SQL Server PowerPivot for SharePoint forum, please see:
    http://social.msdn.microsoft.com/Forums/en-US/9627939c-e9f1-48ae-a6ed-0c238d8f2d69/excel-workbook-with-excel-data-model-stored-on-sharepoint-daily-refresh?forum=sqlkjpowerpointforsharepoint
    Furthermore, this issue is more related to PowerPivot for SharePoint. If you have any more questions about PowerPivot for SharePoint, I would sugget you open a new thread in the forum below for better support:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=sqlkjpowerpointforsharepoint
    Thanks for your understanding.
    Regards,
    Elvis Long
    TechNet Community Support

  • Get variable values from a stored procedure

    I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4 different variables.  I would rather get the 4 variables
    from a stored procedure (which returns all of these 4 values and more) but not sure how to do so.  Below is the code for getting the 4 variable values in my current sp.
    DECLARE @TotalCarb real;
    DECLARE @TotalPro real;
    DECLARE @TotalFat real;
    DECLARE @TotalLiquid real;
    SELECT @TotalCarb = ISNULL(TotCarb,0),
    @TotalPro = ISNULL(TotPro,0),
    @TotalFat = ISNULL(TotFat,0),
    @TotalLiquid = ISNULL(TotLiq,0)
    FROM dbo.vw_ActualFoodTotals
    WHERE (MealID = @MealID);

    You can replace the view with inline table valued user-defined function:
    http://www.sqlusa.com/bestpractices/training/scripts/userdefinedfunction/
    See example: SQL create  INLINE table-valued function like a parametrized view
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • When I login I get a message "aosnotifyd wants to use your confidential information stored in "my name" in your keychain." How do I know if it is safe to allow this? Can anyone advise please?

    Every time I login I get the message "aosnotifyd wants to use your confidential information stored in "my name" in your keychain." How do I know if it is safe to allow this? Can anyone advise please?

    My immediate reaction is to deny.
    Have you downloaded or installed any application that may relate to the abbreviation AOS? It may not necessarily be the application's name, could be the developer or distributor.
    As it's occuring at log-in, go to System Preferences > Accounts > your account > Login Items and look for a related item. If there's one there, right-click (or ctrl click) on it and select Reveal in Finder. That will show you where the originator of the item is on your system and should give you more of a clue as to what it is.
    I'd remove the item from login items anyway (highlight and click the minus sign at the bottom of the window). There shouldn't be anything trying to use your keychain info to notify anyone.

  • To pass new session variable value to stored proc before running a report.

    Hi,
    Below is summary of the report requirement -
    Database level design
    1. Created a view and a global temporary table (GTT)
    2. Created an Oracle package procedure to accept from and to business dates on basis of which it will fetch, process and populate the GTT.
    Repository level design
    1. Created a business model containing the view and the GTT (mentioned above)
    2. Created two SESSION variables "from_dt" and "to_dt" to be initialized by their respective init blocks. Each of the variable is initialized with a DATE column value (of type DATETIME) from a database lookup table. I have also set the option "Enable that variable to be set by any user" for both variables.
    Query for these variables :
    from_dt = select from_date from <table>
    to_dt = select add_months(from_date,12) from <table>
    Presentation level design
    1. Using a text box, i display the default/initialized values of these variables like this -
    Current business date:@{biServer.variables['NQ_SESSION.from_dt']} Future business dt:@{biServer.variables['NQ_SESSION.to_dt']}
    Dates get displayed in YYYY-MM-DD 00:00:00 format
    The text msg displays these default dates and allows the user to specift different date range for which i create prompts as shown below.
    2. Using any random two columns of date type from the business model, i create two date dashboard prompts with labels "From Dt" and "To Dt".
    i select Calender Controls for both; setting Default To = Report Defaults.
    The Set Variable is set to Presentation variables - such that pv_from_dt maps to "From Dt" and pv_to_dt maps to "To Dt".
    3. i create the report using the business model created above. In the report "Advanced Tab" => "Prefix" field i specify the following -
    SET VARIABLE from_dt='@{pv_from_dt}',to_dt='@{pv_to_dt}';
    Note : The logic here is to display the default dates and allow user to specify different date values which will be stored in presentation variables.
    If the user does specify different "from dt" and "to dt" values, then using the presentation variables, i want to "write" back these new values to the corresponding session variables mentioned above.
    If the user does not specify different date range, then the default/initialized dates must be considered.
    I also display the default and new date values in the report title.
    Back to Repository level design
    To execute the stored procedure that will load the GTT before running the report I need to pass two date parameters to the stored procedure on basis of which it will fetch data, process and populate the GTT.
    In the Connection Pool --> Connection Script Tab --> Execute before query, I wrote the below query using the repository variables FROM_DT and TO_DT to execute the procedure -
    DECLARE
    v_from_dt date;
    v_to_dt date;
    BEGIN
    v_from_dt := VALUEOF(From_Dt);
    v_to_dt := VALUEOF(To_Dt);
    package_name1.package_body(v_from_dt,v_to_dt);
    END;
    Now when i try to run the report i get the following error :
    [nQSError: 10058] A general error has occurred. [nQSError: 23006] The session variable, NQ_SESSION.to_dt, has no value definition. (HY000)..
    Need help on this.
    Is it possible to "write back" a new value to a session variable ?
    Any other alternatives.
    Thanks
    Nusrat
    Edited by: user10309945 on Jan 24, 2011 10:08 PM

    Sandeep, I found a several topics where users describe saving values in DB through stored procedure or function. For example, [How to store OBIEE presentation level variable values in DB |http://forums.oracle.com/forums/thread.jspa?threadID=892006] I tried it and get an error
    *10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 14551, message: ORA-14551: cannot perform a DML operation inside a query ORA-06512*
    It's not a BI error. This error are generated by Oracle DB. If I write next:
    SELECT MyPLSQLFunction(p1,p2) FROM DUAL
    I get the same error.
    Oracle doesn't allow DML operations in SELECT.
    Did you relalize this feature yourself? Where did I mistake?

  • Image path not storing in sql database

    Hello,
    I have read here on the forum how to upload an image to server and store path in  your database, the image uploads correctly to the correct folder on my server but the image path does not get stored on my sql database (not local hosting). I receive the error: The file has been uploaded, and your information has been added to the directory. Column 'image' cannot be null.
    My database has the following columns:
    id
    datum
    image
    sectie
    My code is as follows:
    <?php require_once('Connections/dbTroch.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_dbTroch, $dbTroch);
    $query_rs_aanbod = "SELECT * FROM tblSlideshow ORDER BY id ASC";
    $rs_aanbod = mysql_query($query_rs_aanbod, $dbTroch) or die(mysql_error());
    $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    $totalRows_rs_aanbod = mysql_num_rows($rs_aanbod);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    $target = "images/slides/";  //This is the directory where images will be saved// 
    $target = $target . basename( $_FILES['image']['name']); //change the image and name to whatever your database fields are called//
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add-photos-aanbod")) {
      $insertSQL = sprintf("INSERT INTO tblSlideshow (image, sectie) VALUES (%s, %s)",
                           GetSQLValueString($_POST['file'], "text"),
                           GetSQLValueString($_FILES['image']['name'], "text"));
    //This code writes the photo to the server//
    if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
    //And confirms it has worked//
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
    else {
    //Gives error if not correct//
    echo "Sorry, there was a problem uploading your file.";
      mysql_select_db($database_dbTroch, $dbTroch);
      $Result1 = mysql_query($insertSQL, $dbTroch) or die(mysql_error());
    ?>
    <!doctype html>
    <html>
    <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Troch Project Solutions - Admin - Toevoegen</title>
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/layout.css" />
      <!-- Fonts
      ================================================== -->
      <script type="text/javascript" src="//use.typekit.net/vob8gxg.js"></script>
      <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
      <!-- jQuery
      ================================================== -->
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <script src="js/vendor/modernizr.js"></script>
    </head>
    <body>
        <div class="row">
          <div class="large-8 medium-8 small-8 large-centered medium-centered small-centered columns intro">
              <h2 class="subheader text-center">Admin</h2>
              <p><a>Log uit</a></p>
              <p><a href="admin.php">Terug naar Admin menu</a>
              <h4>image toevoegen naar aanbod slideshows:</h4>
              <form action="<?php echo $row_rs_aanbod['']; ?>" method="POST" name="add-photos-aanbod" id="add-photos-aanbod" enctype="multipart/form-data">
              <table>
                    <tbody>
                         <tr>
                              <td><label for="image">Kies foto:</label></td>
                              <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
                        <tr>
                              <td>Sectie:</td>
                              <td><select name="sectie" id="sectie" option value="sectie">
                                <?php
    do { 
    ?>
                                <option value="<?php echo $row_rs_aanbod['sectie']?>"><?php echo $row_rs_aanbod['sectie']?></option>
                                <?php
    } while ($row_rs_aanbod = mysql_fetch_assoc($rs_aanbod));
      $rows = mysql_num_rows($rs_aanbod);
      if($rows > 0) {
          mysql_data_seek($rs_aanbod, 0);
          $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    ?>
                              </select></td> 
                        </tr>
                        <tr>
                            <td><input type="Submit" name="Add" id="add" value="Toevoegen" /></td>
                        </tr>
                </tbody>
            </table>
            <input type="hidden" name="MM_insert" value="add-photos-aanbod" />
        </form>
          </div><!-- end large-8 -->
        </div><!-- end row -->
    <script src="js/vendor/jquery.js"></script>
    <script src="/js/vendor/fastclick.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
                $(document).foundation();
            </script>
    </body>
    </html>
    <?php
    mysql_free_result($rs_aanbod);
    ?>
    I cannot work out what is wrong and I would appreciate any help on this. Thanks

    Your form field and array variable names do not match
    <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
    GetSQLValueString($_POST['file'], "text"),

  • XML Publisher Report EXCEL output Huge stored as Web Pages

    Hello
    I have a XML Publisher Report which generates EXCEL output and the output file size is huge.
    What I notice that it is stored as Web Pages *.htm; *.html (Save as Type) in Excel this is the reason it is huge.
    If I save as Microsoft Office Excel Workbook *.xls it Reduce the size.
    I don't know how to save as ".xls" through XML Publisher using PL/SQL.
    Any body knows? please Help..
    XML Publisher Template Builder for WORD
    Version 5.6 Build 45
    PATCH        BUG_NUMBER
    XDO.H     *3263588*
    4.5.0     *3554613*
    5.0.0     *3822219*
    5.5.0     *4206181*
    5.0.1     *4236958*
    5.6.0     *4561451*
    5.6.1     *4905678*
    5.6.2     *5097966*
    5.6.3     *5472959*
    Thanks.

    Hi Vetsrini,
    We're on 10.1.3.4.1 and siebel 8.1.1.3 and when trying to open a report from within siebel in the output format EXCEL (selected from the parameter applet), it just opens the document in the browser.
    Is there a way to get it to open directly in Excel? I guess the reason is the file extension*.EXCEL, how could we get the extension to be in excel format (xls)?
    We don't want our users to have to do this themself.
    Regards,
    Hakan

Maybe you are looking for

  • Iphone has blocked iTunes for iPod Touch!

    After my iphone 4 was connected to my laptop, Itunes no longer recognizes/connects with my ipod touch. Nothing happens when Ipod is plugged in! Why?

  • [Solved] Graphics driver (nVidia) problem on fresh Arch setup

    Hi, I have installed Arch as main OS about 2 days ago following usual installation wikis. PC is fully functional except for problems with graphics driver (nVidia 340xx) for example just now it took about 3 to 4 boots to get into desktop like 1st boot

  • My ipod is disabled how can i unlock it

    my daughter has put a password on her ipod and now it is locked. it is saying disabled connect to itunes but it is not letting me connect how can i disable it?

  • 1 Sold to Party and N no. of Ship to Party "s?

    Heloo , My Scenerio is like this follows - Please Provide me the solutions . Spencers Head Officer Order to me for 100 Quality of Articles and it directs 10 Branch (Outlets) to deliver . 1.But now my Question is how to map 10 different Ship to partie

  • I can't find the "back button".

    I never have a back button, ever. I have not seen one since upgrading to 4.0. I'm talking about an arrow on screen to go backwards or forwards.