Sql query came to halt

Hi
We have Oracle eBS R12 on unix OS.
The DB version is 10g R2.
From the applications we submitted concurrent request to upload large amount of data.
The undo tablespace increased rapidly and we kept creating new datafiles to accommodate the data,
but it eventually got filled up to the maximum at night.
When i created new datafiles for the undo TS, the usage of TS is not increasing.
the query seems stuck.
what can be the reason?
Thanks for your assistance
Best regards

How big is your undo tablespace and also he UNDO_RETENTION value
you need to increase the size/value of it...
ORA-01555 caused by SQL statement below (SQL ID: 93ah53fvzquhs, Query Duration=128674 sec, SCN: 0x0000.4a06a0f7):
Query Duration=128674 secthis is Too much...
Is it running for 35 hours
Edited by: Maran Viswarayar on Dec 16, 2009 4:19 PM

Similar Messages

  • Need help in Report From SQL Query

    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?

    user602513 wrote:
    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?Do you get any errors or warnings or it is just the slow speed which is the issue?
    There could be a variety of reasons for the delayed processing of this report. That includes parameter settings for that page, cache settings, network configurations, etc.
    - explore best optimization for your query;
    - evaluate portal for best performance configuration; you may follow this note (Doc ID: *438794.1* ) for ideas;
    - third: for that particular page carrying that report, you can use caching wisely. browser cache is neither decent for large files, nor practical. instead, explore the page cache settings that portal provides.
    - also look for various log files (application.log and apache logs) if you are getting any warnings reflecting on some kind of processing halt.
    - and last but not the least: if you happen to bring up a portal report with more than 10000 rows for display then think about the usage of the report. Evaluate whether that report is good/useful for anything?
    HTH
    AMN

  • Dynamic Link in SQL Query Report

    Andy,
    I refromatted the message since it was all garbled, I didn't realize it came out like that the first time.
    1) I am not sure what you meant by the "#" in your message until I did the substitution of #'s for < > I didn't have that in my URL.
    2) Since the whole statement is enclosed in single quotes to be inside of a decode statement I think this is an issue with the javascript and it's double quotes or is it?
    3) I took care of the passing values for items, even if I can just get the link to work some what I would be happy I can worry abou those values later..
    Hello I have a a link that is generated in a report
    sql based on an SQL query and I would like to turn it
    into a popup instead of a direct link. But I seem to
    be having some problems going from a link to a popup
    link...
    <b> I replaced the brackets < > with "#" </b>
    This statement works;
    SELECT decode(create_date, NULL, NULL, '#a
    href="f?p=&APP_ID.:71:&SESSION.::NO:100:P71_EQUIPMENT_
    ID,P71_CONTAINER_TYPE_ID:' || equipment_id || ',' ||
    container_type_id || '"/#' || create_date ||'#/#>' )
    AS "HIST_NOTE",
    </br>
    </br>
    but I would like to turn make it a popup instead of a
    direct link, I think the problem has something to do
    with the parenthesis (double and single mixed) any
    ideas?
    </br>
    </br>
    I tried doubling them up (using three single ticks
    for double parens inside of single ticks and
    everything
    </br>
    </br>
    <b> I replaced the brackets < > with "#" </b>
    decode(create_date,
    NULL,
    NULL,
    '#a href="javascript:popupPage('f?p=&APP_ID.:71:&SESSION.::NO:100:P71_EQUIPMENT_ID,P71_CONTAINER_TYPE_ID:' || equipment_id || ',' || container_type_id || '"/#' || create_date ||'#/a#')" ' AS "HIST_NOTE",
    </br>
    </br>
    Any ideas?
    The error I usually get mostly complains about "ORA-00907: missing right parenthesis"....
    I put an example up on apex.oracle.com if you want to debug it there (it of course does not work right now)
    http://apex.oracle.com/pls/otn/f?p=18490:5
    guest/apex123
    Thanks
    Justin
    Message was edited by:
    Justin P

    Denes,
    I was able to get it working based on one of your examples, it gets ugly when you embed the popup javascript into the link as you know. You have some really great examples, I hadn't been to your page in awhile.
    Here is my end result (this is embedded in a decode statement so single ticks would go around the entire example below)
    &lt;a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:71:&SESSION.::NO:100:'
    || 'P71_EQUIPMENT_ID,P71_CONTAINER_TYPE_ID:'
    || equipment_id || ',' || '&F110_CONTAINER_TYPE_IP.'
    || ''', 900, 600);">'
    || create_date
    || '&lt;/a>
    Thanks to all that helped me out here,
    Justin

  • SQ01, SQ01 - Sql Query  Dislplay problem

    Hi
    Need help in SQL Query
    I generated one sql query which has the following output in general .
    Customer      name            description        amount
    asrq1           sharekhan      Amount payed           10
    asrq1           sharekhan      Amount Advance        20
    asrq1           sharekhan      Amount due           30
    but i need the output in the following way
    Customer      name            AMount payed     Amount Advance    Amount Due
    asrq1           sharekhan             10             20                        30
    and iam new this sql query but came to know we can write code ..but iam unable to initiliaze to write
    a peace of code as i dont know what are the select-options defined ..i saw in the include but didnt got it
    % comes prefix of select-options,and iam unable to get he internal table which is displayed in the query .
    can anyone help me in this answers will be awarded points.

    and transaction FBL5N does not work in your company because ... ???

  • Using WHERE command in property loader SQL query

    Hello All,
    Hopefully this will be a fairly straight forward question.
    I am attempting to use Property Loader to read in test limits from a SQL database. There are many types of models that need to be tested, each having a unique set of limits. I want to be able to retrieve the appropriate limits for the model of product under test.
    To do this I have the product model number available in a FileGlobal. The database contains a table with the test limit information with an identifying 'ModelNumber_Number' column.
    I have written the following SQL query achieve this:
    "SELECT *  FROM TESTLIMITS WHERE ModelNumber_Number=+ FileGlobals.ModelNumber"
    However, this is where I am confused. I'm not sure on the syntax for accessing a variable in the SQL command. I receive the following error:
    The multi-part identifier "FileGlobals.ModelNumber" could not be bound.
    Can someone please provide guidence on how to do this?
    Many thanks,
    Cam.
    Solved!
    Go to Solution.

    Thank you very much for your reply.
    Upon changing the query to as you suggest, I am presented with the following:
    Error In SQL Statement Expression. "SELECT *  FROM TESTLIMITS WHERE ModelNumber_Number = " + FileGlobals.ModelNumber
    Specified value does not have the expected type.
    The type of FileGlobals.ModelNumber is a numeric represented as a double precision 64 bit signed integer.
    The database column is also of type int 64.
    Can you suggest a solution?
    Many thanks.

  • SQL query in powershell Errors on IIF

    Hello,
    I have put together a Powershell script from examples online to run a SQL query.  The query came from Access and it seems Powershell has a problem with the syntax.
    I'm pretty new to scripting and adding SQL to the equation isn't helping.
    Powershell code
    $SQLServer = "ServerName"
    $SQLDBName = "DataBase"
    $SqlQuery = 'MyQuery'
    $SqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"
    $SqlCmd = New-Object System.Data.SqlClient.SqlCommand
    $SqlCmd.CommandText = $SqlQuery
    $SqlCmd.Connection = $SqlConnection
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $SqlAdapter.SelectCommand = $SqlCmd
    $DataSet = New-Object System.Data.DataSet
    $SqlAdapter.Fill($DataSet)
    $SqlConnection.Close()
    $DataSet.Tables[0] | ft -AutoSize
    SQL Query
    SELECT swName AS Server, swRack AS Rack, swEnvironment AS Environment, IIf([dbo.SW_SERVICE_LVL].[swMonday]=1,"Mon") AS [RebootSchedule], dbo.SW_SERVICE_LVL.swMonBeginTime AS [RebootTime], 2 AS Expr
    FROM dbo.SW_SERVICE_LVL INNER JOIN dbo.SW_SPECIALTY ON dbo.SW_SERVICE_LVL.swDiscount = dbo.SW_SPECIALTY.swSpecialtyId
    WHERE (((IIf([dbo.SW_SERVICE_LVL].[swMonday]=1,"Mon")) Is Not Null) AND ((dbo.SW_SERVICE_LVL.swGrpResp)="IT Group Name") AND ((dbo.SW_SERVICE_LVL.swRootObjectType)="Server"));
    Error given is
    Exception calling "Fill" with "1" argument(s): "Incorrect syntax near ')'.
    Incorrect syntax near 'IIf'."At line:16 char:1
    + $SqlAdapter.Fill($DataSet)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : SqlException

    This might be considered a new question but now I got the powershell code to return data from the SQL database.
    Now I am looking to output the table to a powershell Array then append the LastRebootTime into that Array.  As far as I can tell, this requires a ForEach loop on each servername returned from the SQL query.  And I'm stuck on getting that working.
    Stop thinking like you know what that means.
    Where are you getting lastreboottime? Why does it have to be appended.  "Reboottime" is one of thefields in or query.  You don't need it.
    ¯\_(ツ)_/¯
    That is a bit strongly worded.  Here's what I've got and this is still a work in progress.  I've said this before, I am not a scripter.  Now I am stuck on adding the LastBootUpTime column into the table returned from the SQL query.
    $SQLServer = "ServerName"
    $SQLDBName = "DataBase"
    $SqlQuery = 'MyQuery'
    $SqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"
    $SqlCmd = New-Object System.Data.SqlClient.SqlCommand
    $SqlCmd.CommandText = $SqlQuery
    $SqlCmd.Connection = $SqlConnection
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $SqlAdapter.SelectCommand = $SqlCmd
    $DataSet = New-Object System.Data.DataSet
    $SqlAdapter.Fill($DataSet) | Out-Null
    $arraydata = @($DataSet)
    $SqlConnection.Close()
    $servers = @($DataSet.Tables[0]) | select -ExpandProperty Server
    Try{
    foreach ($server in $servers)
    $arraydata += @(GWMI -ComputerName $server -Class Win32_OperatingSystem -ErrorAction SilentlyContinue | select @{LABEL="Server";Expression={$_."csname"}}, @{LABEL='LastBootUpTime'
    ;EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}})
    }#end try
    Catch{
    "Can't work with $server"
    $DataSet.Tables[0] | ft -AutoSize #Export-Csv -NoTypeInformation -Path c:\sunday.csv
    $arraydata

  • Is there a fix limit how long an SQL query may be?

    Hello,
    I am currently writing an application (java/jdbc/thin-driver) which executes a simple but very big query which looks like the following:
    SELECT CALKEY, PERSNO, MANDT FROM PERSONS WHERE MANDT='1' AND PERSNO='100471' OR MANDT='1' AND PERSNO='100838' OR MANDT='1' AND PERSNO='101010' (to be continued the next 400kb)
    For now I am not able to test it with oracle but a not as professional database aborts simply by throwing an SQLException even with that "small" 400kb query, however this query could easily grow to 2-5mb too.
    Will the oracle jdbc-thin driver correctly process that large queries (and how fast?) and are there limits for the size of an SQL query?
    Thank you in advance, lg Clemens

    Hello and thats a lot for the suggestions and tips you gave me.
    where does all those 100471, 100838 came from ? would
    not it make sense to have those in the database?The problem lies in the fact that I get this data from our sap->db interface with beeing the "100471" the personal numbers of our users. So it would not make that much sence (from the performance point of view) to create a temporary table since the whole time needed to create+fill+drop the table would take longer than this approach.
    Thanks for the tips with the different synthax this really should reduce the lenght of the query.
    I also implemented a lenght-limit now, if the query string would become larger than a dynamically set limit a second query is generated and results are both added to a list.
    Thanks a lot for all this useful tips and suggestion, lg Clemens

  • Build stored procedure from a dynamic SQL query

    I have the following method, that receives a string from a textbox and creates a dynamic select command. Since I am using a dataSet I cannot execute a dynamic SQL query by calling a method of a strongly-typed dataset (.xsd). I have been told that the best
    way to do this is to pass an array of values to the stored procedure.
    But I have no clue how to build the stored procedure.
    string[] allWords = txtSearch.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    string sql = "SELECT Books.ISBN, Books.Title, Books.Tag, Books.Image, Books.photoType, Publishers.Name AS publisherName FROM Books INNER JOIN Publishers ON Books.codPublisher = Publishers.codPublisher WHERE ";
    using (SqlCommand command = new SqlCommand())
    for (int i = 0; i < allWords.Length; ++i)
    if (i > 0)
    sql += "OR ";
    string paramName = "@param" + i.ToString();
    sql += string.Format("(Books.Title LIKE {0}) ", paramName);
    command.Parameters.AddWithValue(paramName, allWords[i] + "%");
    command.CommandText = sql;
    //execute the SQL query against the db...

    After hours around this, I have came with this solution.
    private SqlConnection sqlConn = new SqlConnection();
    private System.Data.DataSet dataSet = new System.Data.DataSet();
    private System.Data.DataTable dataTable;
    private System.Data.DataRow dataRow;
    private SqlCommand search(string searchParam, int searchOption)
    SqlCommand command = new SqlCommand();
    string sql;
    string[] allWords = searchParam.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    if (searchOption == 1)
    sql = "SELECT Livros.ISBN, Livros.Titulo, Livros.Tema, Livros.Resumo, Livros.Imagem, Livros.fotoTipo, Editoras.Nome AS nomeEditora FROM Livros INNER JOIN Editoras ON Livros.codEditora = Editoras.codEditora WHERE ";
    else
    sql = "SELECT Livros.ISBN, Livros.Titulo, Livros.Tema, Livros.Resumo, Livros.Imagem, Livros.fotoTipo, Editoras.Nome AS nomeEditora FROM Livros INNER JOIN livrosAutores ON Livros.ISBN = livrosAutores.ISBN INNER JOIN Autores ON livrosAutores.idAutor = Autores.idAutor INNER JOIN Editoras ON Livros.codEditora = Editoras.codEditora WHERE ";
    using (command)
    for (int i = 0; i < allWords.Length; ++i)
    if (i > 0)
    sql += "OR ";
    if (searchOption == 1)
    sql += string.Format("(Livros.Titulo LIKE '%{0}%') ", allWords[i]);
    else
    sql += string.Format("(Livros.Autor LIKE '%{0}%') ", allWords[i]);
    command.CommandText = sql;
    return command;
    protected void Bind()
    sqlConn.ConnectionString = Properties.Settings.Default.BibliotecaConnectionString;
    string connectionString = sqlConn.ConnectionString.ToString();
    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(search(searchText, searchOption).CommandText, connectionString);
    sqlDataAdapter.Fill(dataSet, "livrosTitulo");
    dataTable = dataSet.Tables["livrosTitulo"];
    dataGrid.DataContext = dataTable.DefaultView;

  • SQ01 DIsplay Problem (Can v write abap code ) Sql Query

    Hi
    Need help in SQL Query
    I generated one sql query which has the following output in general .
    Customer   name   description   amount
    asrq1  sharekhan      Amount payed      10
    asrq1  sharekhan     Amount Advance     20
    asrq1  sharekhan    Amount due             30
    but i need the output in the following way
    Customer  name  AMount payed     Amount  Advance                  Amount Due
    asrq1   sharekhan  10    20     30
    and iam new this sql query but came to know we can write code ..but iam unable to initiliaze to write
    a peace of code as i dont know what are the select-options defined ..i saw in the include but didnt got it
    % comes prefix of select-options,and iam unable to get he internal table which is displayed in the query .
    can anyone help me in this answers will be awarded points.

    First, I will suggest to go for ABAP report for this kinda requirement.
    If you really want to go for it through SQ01, even then you will have to write some ABAP to display the records in one row. You will need to create three custom fields.
    I will give Psudo for one field:
    Field Name := ZAmountPayed
    Select Amount_Payed into varAmountPayed from Table Where Emp# = '12345'
    ZAmountPayed := varAmountPayed
    Convert the above into relative ABAP code and create 2 more similar fields, and you should be all set.
    You have to know the table names and any other calculations to get the right data.

  • Problem for create report by sql query under Protal!

    I'm trying create report by sql query method, however it came out the error:
    ORA-00918: column ambiguously defined (WWV-11230)
    Failed to parse as SENTRYDB - select distinct t1.firstnames, t1.lastname, t4.PERSONGROUP, to_char( t1.dateofbirth, 'DD-MM-YYYY' ) as "Dateofbirth", t3.ADDRESS, t3.CITY, t3.STATE, t3.CODE, t3.HOMETELEPHONE, t3.WORKTELEPHONE, t3.INTERESTING, t3.personid from pnames t1, people t3, groups t4 where t3.persongroup = t4.groupid and t1.personid = t3.personid order by rowid (WWV-08300)
    Error: Unable to execute query (WWV-10201)
    The query is :
    select distinct t1.firstnames, t1.lastname, t4.PERSONGROUP, to_char( t1.dateofbirth, 'DD-MM-YYYY' )
    as "Dateofbirth", t3.ADDRESS, t3.CITY, t3.STATE, t3.CODE, t3.HOMETELEPHONE, t3.WORKTELEPHONE, t3.INTERESTING, t3.personid
    from pnames t1, people t3, groups t4
    where t3.persongroup = t4.groupid
    and t1.personid = t3.personid
    I have no problem to run that query under sqlplus!

    Hi,
    I'm cuurently using the portal inside of 9iAs 1.0.2.2.2a. What version of that Portal? By the way, how can I find out the version of Portal that I using? And also can I display image inside of report which created by Portal? I tried statement:
    select
    '<IMG SRC="'|| decode(IMAGE, '', SJAYARAM309.wwctx_api.get_image_path || 'noimg.jpg',
    owa_util.get_cgi_env('DOC_ACCESS_PATH') || '/' || IMAGE) ||'">' stu_pic,
    from stu
    However, it doesn't work. It came out error:
    Unable to describe SQL statement. Please correct it (WWV-13010)
    Invalid SQL statement: select '<IMG SRC="'|| decode(IMAGE, '', SJAYARAM309.wwctx_api.get_image_path || 'noimg.jpg', owa_util.get_cgi_env('DOC_ACCESS_PATH') || '/' || IMAGE) ||'">' pic from test (WWV-13005)
    ORA-01001: invalid cursor (WWV-11230)
    ORA-00904: invalid column name (WWV-11230)
    Failed to parse as SENTRYDB - select '<IMG SRC="'|| decode(IMAGE, '', SJAYARAM309.wwctx_api.get_image_path || 'noimg.jpg', owa_util.get_cgi_env('DOC_ACCESS_PATH') || '/' || IMAGE) ||'">' pic from test (WWV-08300)
    Do you know why?

  • Combine and simplify SELECT and UPDATE sql query

    foreach (BidList t in bidList)
    query = "SELECT operator_id, plot_id, status FROM booking " +
    "WHERE status='open' AND postcode='" + _plot + "' AND operator_id='0'" +
    "ORDER BY datetime ASC;" +
    "UPDATE booking SET operator_id='" + t.OperatorId + "', status='allocated' " +
    "WHERE (plot_id=" + t.PlotId + " AND operator_id='0' AND status='open') LIMIT 1;";
    dbObject.InsertBooking(query);
    I am cleaning up my code, and came across the above SQL query. Before I make use of SQL parameters, I wanted to ask if it is possible to combine them, and if so, how?

    Consider making a single long query using ‘;’ as a separator:
        query = "";
        foreach (BidList t in bidList)
            query += "UPDATE . . . ; ";
        dbObject.InsertBooking(query);
    Use StringBuilder for more improvements.

  • Using multiple sql query

    Im writing a jsp that pulls data from the database and loads it into dropdown-list looks like this:
    <select name="Source">
    <%
    conn = DriverManager.getConnection(url, username, password);
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = stmt.executeQuery("SELECT BBCourseID(Sroffer.SrofferID)course_name, SrofferSchedule_Faculty.FacultyID AS FacultyID FROM SrofferSchedule_Faculty srofs JOIN SrofferScheduleID sros ON srofs.SrofferScheduleID= sro.SrofferScheduleID JOIN Sroffer sro ON sro.SrofferID= sros.SrofferID WHERE srofs.FacultyID=IDnumber");
    rs.beforeFirst();
    while (rs.next()) {%>
    <option value="<%=courseid=rs.getString("BBCourseID")%>"><%=courseid%> <%=rs.getString("course_name")%></option>
    <%}
    %>
    </select>
    Problem is, I have to pull the FacultyID from cams using this sql query
    ("SELECT FacultyID FROM FacultyPortal WHERE PortalAlias="") berfore i can run the query above. Don't know how to do this in a jsp
    Edited by: JohnsonJ on Mar 26, 2009 5:53 PM

    You know how to get a connection and how to execute a query and how to process the resultset - so what's standing in your way of doing that for the faculty ID?
    Isn't there a join you can do to get that in one query?
    And finally - you really shouldn't do this in a JSP, use a servlet to package the result up in some Java Collection and process it with JSTL tags.

  • Modify SQL Query

    Hi,
    Can the below SQL Query be modified in any simpler way.
    IF (V_BillingTypeID = 2) THEN
        select count(*)
          into V_AuthCount
          from payerauthorization pa
         where pa.patientidentificationno = IV_PatientIdentifierno
           and pa.registrationno = IV_UHID;
    if (V_AuthCount > 0) then
          select pa.responsetype, pa.payerapprovedamount
            into V_ResponseType, V_ApprovedAmt
            from payerauthorization pa
           where pa.patientidentificationno = IV_PatientIdentifierno
             and pa.registrationno = IV_UHID;
                 if V_ResponseType = 3 then
                    V_ServiceTariff := V_ServiceTariff -
                               (V_ServiceTariff * (V_ApprovedAmt / 100));
                 end if;
           if V_ResponseType = 2 then
              select (pb.totalbillamount + pb.discountamount)
              into V_GrossBillAmt
              from patientbill pb
                where pb.billno = IV_BillNo;
              V_AuthPercentage := ((V_ApprovedAmt / V_GrossBillAmt) * 100);
               V_ServiceTariff  := round(V_ServiceTariff -
                                      (V_AuthPercentage *
                                      (V_ServiceTariff / 100)));
            end if;
                  if V_ResponseType = 5 then
                      select (pb.totalbillamount + pb.discountamount)
                      into V_GrossBillAmt
                         from patientbill pb
                           where pb.billno = IV_BillNo;
                            V_AuthPercentage := ((V_ApprovedAmt / V_GrossBillAmt) * 100);
                             V_ServiceTariff  := round(V_ServiceTariff -
                                      (V_AuthPercentage *
                                      (V_ServiceTariff / 100)));
                   end if;
      end if;
          select Count(*)
          into V_CRCount
          from creditnote cr
          where cr.billno = iv_Billno;
                          if (V_CRCount > 0) then
                           select cr.creditnoteamount
                             into V_RefundedAmount
                              from creditnote cr
                              where cr.billno = iv_Billno;
                          end if;
        SELECT SUM(GC.REFUNDAMOUNT) INTO V_GCREFUNDAMOUNT FROM GBCREDITNOTE GC;
        V_MAXREFUNDAMOUNT := (V_PatientPaidAmount - (NVL(V_GCREFUNDAMOUNT, 0) +
                             NVL(V_RefundedAmount, 0)));
    END IF;Thanks in advance.

    Few things i came across are
    1. You could remove the query where you do COUNT() just to check if data exist before SELECT..INTO. You can use EXCEPTION handling insted.
    2. The condition V_ResponseType = 2 adn V_ResponseType = 5 looks same so you can combine it into a single condition.
    I have modified it like this.
    if (v_billingtypeid = 2) then
            begin
                  select pa.responsetype
                       , pa.payerapprovedamount
                    into v_responsetype
                       , v_approvedamt
                    from payerauthorization pa
                   where pa.patientidentificationno = iv_patientidentifierno
                     and pa.registrationno = iv_uhid;
                  if v_responsetype = 3 then
                      v_servicetariff := v_servicetariff - (v_servicetariff * (v_approvedamt / 100));
                  end if;
                  if v_responsetype in (2, 5) then
                      select (pb.totalbillamount + pb.discountamount)
                        into v_grossbillamt
                        from patientbill pb
                       where pb.billno = iv_billno;
                      v_authpercentage := ((v_approvedamt / v_grossbillamt) * 100);
                      v_servicetariff  := round(v_servicetariff -(v_authpercentage *(v_servicetariff / 100)));
                  end if;
            exception
                    when no_data_found then
                            null;
            end;
            begin
                    select cr.creditnoteamount
                      into v_refundedamount
                      from creditnote cr
                     where cr.billno = iv_billno;
            exception
                    when no_data_found then
                            null;
            end;
            select sum(gc.refundamount)
              into v_gcrefundamount
              from gbcreditnote gc;
            v_maxrefundamount := (v_patientpaidamount - (nvl(v_gcrefundamount, 0) + nvl(v_refundedamount, 0)));
    end if;Edited by: Karthick_Arp on Feb 21, 2013 3:26 AM
    Fixed BEGIN..END mismatch.

  • SQL Query on Planning Repository

    Hi all,
    Let's say that I have an Entity Hierarchy as follows:
    - Entity
    + E1
    + E2
    + E3
    E31
    E32
    + E4
    E41
    E42
    + E5
    E6
    E7
    + E8
    E31 (Shared)
    and we have access control set at group level:
    - G1 has write access to Idesc(E1)
    - G2 has write access to Idesc(E2)
    - G3 has write access to Idesc(E3)
    - G4 has write access to Idesc(E4)
    - G5 has write access to Idesc(E5)
    - G8 has write access to Idesc(E8)
    I have one user U2 who belongs to G2.
    How could I build a SQL query to determine if U2 has access to Base Entity E31?
    I have taken a look to http://camerons-blog-for-essbase-hackers.blogspot.nl/2011/10/stupid-planning-queries-6-security.html
    although we would have to check if the base entity belongs to any of the entities where U2 has access.
    Thanks for any help.

    I believe it's commonly known that it's case sensitive. e.g. it's documented here:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=using_recordsets_7.html
    "Unlike the rest of ColdFusion, Query of Queries is case-sensitive. However, Query of Queries supports two string functions, UPPER() and LOWER(), which you can use to achieve case-insensitive matching."

  • How to modify a SQL query?

    Hi all,
    I am using Crystal Reports version 10. I have a number of reports that have been written by a software vendor wherby the name of the database they were connected to when the report was written is coded into the FROM command of the reports SQL query, eg "GCUK_2" in the of the SQL snippet below.
    SELECT "Clients"."NAME", "Quotes"."QUOTE_ID", "Quote_Items"."UPRICE", "Quote_Items"."QTY", "Quote_Items"."UOM", "Quote_Items"."QUSAGE_ID", "Report_Control"."QUSAGEID", "Quote_Items"."STANDARD", "Quote_Items"."SECT_FLAG", "Quote_Items"."DISPORDER", "Quotes"."DESCRIPT", "Report_Control"."SECT_NAME", "Quote_Items"."CNT", "Category_and_Type"."TYPEDESC", "Quote_Items"."DESCRIPT", "Report_Control"."DISP_SORT"
    FROM   ((("GCUK_2"."schedwin"."QTE_CTRL" "Report_Control" INNER JOIN "GCUK_2"."schedwin"."QUSAGE" "Quote_Items" ON "Report_Control"."QUSAGEID"="Quote_Items"."QUSAGE_ID") LEFT OUTER JOIN "GCUK_2"."schedwin"."QUOTES" "Quotes" ON
    I have tried setting the Datasource Location, but it doesn't change the query at all. I have read on another forum that you can generate another SQL query using the Database Expert, Current Connections, then right click the Add Command for the database you want to create a SQL command. Is this the only way to update the database names in the query?
    Thanks,
    Scott.

    Hi Sourashree,
    Thanks for that. All the reports were created by the vendor using tables as opposed to the command object. I would have thought that changing the datasource would automatically cause Crystal to rewrite the SQL query syntax, but this doesn't appear to be the case.
    Yes, I've noticed that modifying the record selection will change the sql query. The only way I can see to change the database name in the query is to change to the desired databsource and then remove and re-insert the tables, which will then update the query with the correct name. However, this seems to be a convoluted way of changing the db name in the query.

Maybe you are looking for

  • Where can i find Win8 graphic drivers for Qosmio X870-BT2G23?

    Hello, I brought the new Qosmio X870. It comes with Seagate Mumentos XT 750GB hybrid drive, I have installed Intel 120GB SSD on the free slot and 1st surprise no option for RAID on BIOS. As top of the line gaming machine this option should be availab

  • Numeric or value error problem

    Hi, I created the following function on Oracle 8i: create or replace function get_pub_info(p_inbox in varchar2) return varchar2 deterministic is cursor c_pub(p_inb varchar2) is select a.pub_name, a.pub_code,      b.fprocess_id from pub a, fprocess b

  • Can AD work with different forests?

    Hello Community     Using AD is it possible to bring in a "group" from a domain in one forest into a group in a domain in a different forest when a one-way trust relationship exists, if so how?     Note: If it is possible can the users "friendly" use

  • Wierd bzr issue.

    Whenever I resize a window whenever I'm checking out a branch using bzr, I automatically stops checking out the branch. I'm using xmonad. I get the following error: bzr: ERROR: [Errno 4] Interrupted system call

  • MS Office 2011 won't open ager my Mavericks install.  I've reinstalled Office, but none of the programs will open.  Ideas?  Thanks!

    Any help available?  MS Office 2011 won't open after my Mavericks install.  I've reinstalled Office, but none of the programs will open.  Ideas?  Thanks!