Query on Database Functions

Hi ,
I was failed to send input value to sql Query in query-database() function.
<xsl:value-of select='orcl:query-database("select C_Code from Test_Currency where C_Name=/ns1:SyncTestProcessRequest/ns1:input",false(),false(),"jdbc:oracle:thin:system/admin@localhost:1521:XE")'/>
If i give like below it gives correct value
(select C_Code from Test_Currency where C_Name ='INR',,,)
But I want to send input value to that query, then how can I pass my i/p value to query.
don't suggest me use DB adapter :-)
Regards
Bhargavi

wrong forum. This is for the SQL Developer tool, not SQL questions. There are several other fora which you can use for this. On another note, why dont u use DB Adapter? ;-)

Similar Messages

  • Return value from database function taking a lot more time than the query

    Hi guys,
    I have a Query that does a call to a database function. The function takes in a few parameters and returns a Date. Now, the query within the function takes barely .05 seconds. However, doing a select get_join_dates from dual is taking almost 6 seconds for each call.
    Here is the Query:
    select s.student_id, s.student_name, s.organization_code
    from   student s
    where  s.student_id = :p_student_id
    and    s.student_enrollment_date = get_join_dates( :p_year,
                                                       :p_month,
                                                       :p_student_id,
                                                       s.organization_code );And here is the database function. The select inside this function barely takes 0.05 seconds per call. This function gets called 3 times in my case as there are 3 records in the org_body table for this student.
    create or replace function
    get_join_dates( p_yyyy in org_body.fiscal_yyyy%type,
                           p_month in  org_body.fiscal_mm%type,
                           p_student_id in student.student_id%type,
                           p_organization_code in org_body.organization_code%type) return date as
        t_enrollment_date  date;
        cursor cur_latest_enrollment_date is
          select max(enrollment_date)
          from   org_body
          where  fiscal_yyyy = p_yyyy
          and    fiscal_mm = p_month
          and    student_id = p_student_id
          and    organization_code = p_organization_code;
      BEGIN
        open cur_latest_enrollment_date ;
        fetch cur_latest_enrollment_date into t_enrollment_date;
        close cur_latest_enrollment_date ;
        return t_enrollment_date;
      exception
        when others then
          null;
    end;owever, when I run the following statement below, it takes close to 6 seconds to retrieve a record. In turn, my Query is becoming really slow and taking almost 35 seconds. Imagine that with more records.
    select get_join_dates( 2010, '01', '2167543', 'PSYCH01' ) from dual;If I run my query with this condition below, it takes 0.5 seconds.
    select s.student_id, s.student_name, s.organization_code
    from   student s
    where  s.student_id = :p_student_id
    and      s.student_enrollment_date = '01-JAN-10'Any ideas would be greatly appreciated.

    Any reason why you are doing this with the stored function?
    You could just do this with SQL. Embed the query in the function as a subquery in your initial query from STUDENT.
    select s.student_id, s.student_name, s.organization_code
    from   student s
    where  s.student_id = :p_student_id
    and    s.student_enrollment_date =
    (select max(enrollment_date)
          from   org_body
          where  fiscal_yyyy = :p_year
          and    fiscal_mm = :p_month
          and    student_id = s.student_id
          and    organization_code = s.organization_code);Why your function is not performing: I cannot say that with the information you have provided.
    Maybe sqltrace a call and see what the reason is.

  • Problem in using query-database() function in Transformation

    Hi All,
    I am using JDev and SOA 10.1.3.4.
    I have an async process.
    In that I am doing a transformation in which source is InputVariable and target is result.
    In Transformation I am using query-database function to fetch a record from DB and am assigning that to result.
    *<xsl:value-of select='orcl:query-database(concat("select ename from emp where empid=",/ns1:DBXSLProcessRequest/ns1:input),false(),false(),"jdbc:oracle:thin:scott/tiger@localhost:1521:abcd")'/>*
    I am not getting any error but query-database is not returning any thing I maen it is returning null.
    If i run that query in SQL prompt it is returning the empname.
    Please help me out.
    Regards
    PavanKumar.M

    Hi Pavan
    I tried following in BPEL transform actvity's XSL file, and it works fine and returns the sysdate for me.
    <xsl:value-of select='orcl:query-database("select sysdate from dual",false,false,"jdbc/myDS")'/>
    Can you try above in new XSL file of Transform activity and let me know its gives you the result? if it works you can start making changes according to your requirement.
    steps to follow:
    1.create connection pool in EM, and make sure its working fine by using test on connection pool.
    2.create Datasource and point to above created connection pool. and restart the oc4j_soa
    3.rename the xsl file name of transform activity in BPEL and use above query-database function.some times xsl files are cached even if you make changes it will not take effect so for testing if you rename it will be good.
    Thanks
    Seshagiri.Rayala
    http://soabpel.wordpress.com/

  • How to use query-database() function in transformation?

    Hi All,
    How to use query-database() function in transformation?
    It is giving four fields but if i write select query in sqlquery field it is saying select node is not found....
    plz help me out
    Regards
    Pavankumar
    Edited by: [email protected] on Jul 29, 2009 2:49 AM

    Hi,
    To answer your query:-
    http://abhishek-soablog.blogspot.com/2008/08/orclquery-database.html
    Cheers,
    Abhi...

  • Query to identify Workbooks dependent on Discoverer/Database Function

    Hi,
    We are having a Discoverer/Database function that is being used in several Discoverer Reports.
    We now have to add a parameter to that function and we are not sure on what all reports are actually using this function.
    Can you please provide me the query (or) an approach to identify all the discoverer workbooks that are dependent on this function?
    Appreciate your help.
    Thanks,
    Kesava

    Hi Tracy,
    there is no connection between those workbooks, the adjusted reports are saved as new reports and
    there is no pointer to the original report it was created from.
    Tamir

  • Cannot query v$database in a function ?

    Hi, probably a simple explaination for this...
    I'm trying to implement a solution using the flashback feature to roll back a table if a process flow hits errors.
    I have defined a function that tries to return the CURRENT_SCN from V$DATABASE but it says "ORA-00942: table or view does not exist" when I try to deploy from the code editor.
    I can get the same code to work fine against a test table I have.
    Anything special I need to do before I can query V$DATABASE ?
    I can issue the same select statement from Oracle SQL Plus and it works ok.
    Thanks
    Paul

    Hi,
    I think you have no select permission on this view. In a function you have the same permissions as the user who created this function and you have no permissions granted by role - only direct granted to the user.
    This is the same for functions and procedures.
    Regards
    Detlef

  • Database connection(select ,insert query) within javascript function

    Hi ,
    How to write the database connection(insert,delete or select query) within javascript function.Is it possible.Anyone can you help me
    than you

    Hi ,
    How to write the database connection(insert,delete
    ete or select query) within javascript function.Is it
    possible.No

  • How to pass parameters to query-database function [Solved]

    Dear All,
    I'm working on a BPEL process which reads a file and the data is passes on
    to a web service. In the transform activity to transform data from the source to the
    web serivice parameters, I want to use the query-database function to check if
    the value given in the file exists in the database. I have added a 'If' XSL construct
    for this. Now when the query is static (given with hardcoded where clause), the
    query-database function works fine. But I want to use one of the column in the
    source variable in the SQL query I'm using in the query-database function.
    i.e. If I give the query as below it is working:
    <xsl:if test="orcl:query-database("select empno from emp
    where empno='10'",.....) > 0">
    I want to replace the hardcoded value 10 with the value from the source variable.
    I'm not sure how this should be done. If I refer to the element directly in the XSL
    it is not working. I've shown this below.
    <xsl:if test="orcl:query-database("select empno from emp
    where empno='/tns:Root-Element/tns:Data/:tns:Empno'",.....) > 0">
    Something like above does not work. I'm not sure also if the syntax is correct. It
    does not give any error, but the transformation does not happen.
    Is there any way you can pass any input value as a parameter to the
    query-database function?
    Thanks in advance
    -Ruban

    Hi Dipal,
    The concat works! Thank you very much for the help. I didn't try concat before.
    I was using a alphanumeric field, so it was required to add one more concat
    for enclosing the value with single quotes. For numerical fields, one concat would
    be enough as you had shown.
    My xsl looks like this now:
    <xsl:if test="orcl:query-database(concat(concat("select empno from emp
    where empno='",/tns:Root-Element/tns:Data/:tns:Empno),"'"),
    false(),false(),"jdbc/DbConnection") > 0">
    This works properly.
    Regards,
    -Ruban

  • SQL query (pl/sql function body returning query) performance issue

    I create my report in building my sql instruction with ( SQL Query pl/sql function body returning sql query );
    My report take more than 20 seconds however if i did a cut and paste with the sql code in TOAD the same sql take 1 second.
    To try to discover the source of the problem; i take the sql generated by the function and i create another report ( sql query ) this new report take 2 seconds.
    My query is very big 25,000 characters with database link.
    What is the difference between SQL-quey and sql-query(pl/sql function body returning sql query)
    Thanks
    Marc

    Marc,
    Firstly...don't compare the timings from Toad, since often Toad only fetches the first few records for you (i.e. it pages them).
    Secondly....the database link could be a factor here, but without seeing your query it's too hard to say.
    Can you post the query somewhere (on a webserver say)?

  • Query not considering function based index in oracle 11g

    I have a query which used Function Based Index when run in oracle 9i but when I run the same query
    without any changes, it does not consider index. Below is the query:
    SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
    patient_role.emergency_contact_name,
    patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
    patient_role.emergency_contact_relation_id,
    patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
    patient_role.CREATED_TIMESTAMP,
    patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
    patient_role.UPDATED_TIMESTAMP_TZ,
    patient_role.discontinued_date
    FROM encounter, patient_role
    WHERE patient_role.patient_role_key = encounter.patient_role_key
    AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
    :SYS_B_2))
    AND patient_role.discontinued_date IS null
    AND encounter.discontinued_date IS null ;
    Index definition:
    CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
    '0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT)
    TABLESPACE "user1"
    Database : Oracle 11g (11.2.0.3)
    O/S : Linux 64 bit (the query does not consider index even on windows os)
    Any suggestions?
    -Onkar
    Edited by: onkar.nath on Jul 2, 2012 3:32 PM

    Onkar,
    I don't appreciate you posting this question in several forums at the same time.
    If I would know you also posted this on Asktom, I wouldn't even have bothered.
    As to your 'issue':
    First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
    Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
    But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
    Right now you are already putting workaround on workaround on workaround on workaround.
    Issue is the application: it is terminal., and you either need to kill it, or to replace it.
    Sybrand Bakker
    Senior Oracle DBA

  • SQL Query (pl/sql function body returning Sql query)

    Hi All,
    I have created a region of "SQL Query (pl/sql function body returning Sql query)" type and it is working fine , but when I am migrating(export /import) this application from development to systest environment ,
    It gives error for this region :
    Error ERR-1101 Unable to process function body returning query.
    OK
    ORA-06550: line 1, column 52: PLS-00306: wrong number or types of arguments in call to 'FU_TRADE_REPORT_QUERY' ORA-06550: line 1, column 45: PL/SQL: Statement ignored
    Any pointer ...why this is happening.
    Thanks
    Dikshit

    If your function is a stored function that is called from within APEX (function body not coded into the app itself), have you made sure that the function has been created and compiles ok prior to installing your apex app.
    If there are some dependency issues between other PL/SQL units or database objects that are causing your function not to be compiled, you apex install will fail as you are trying to reference an uncompelled bit of pl/sql.
    Let me know how you get on
    Regards
    Duncan

  • How to pass dynamic parameter to a database function in OBIEE

    Hi,
    I have a requirement like this. I have to create one report in OBIEE which was in Discoverer. Now in discoverer report there are some calculated item in the worksheet based on database pkg.functions. The parameter which user gives at run time that parameters are then passed to the discoverer calculated items dynamically. But I am not able to do this in OBIEE answers.
    Can anyone tell me step by step how I can able to pass the user selected parameter values in OBIEE answer level.
    The example:
    GET_COMM_VALUE_PTD("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id)
    GET_COMM_VALUE_PTD --- Function database
    ("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id --- Parameters... :"Period Name(AFE)" is the dynamic parameter selected run time by user.
    Please help.
    Thanks
    Titas

    Hi,
    I already did that. But the existing discoverer re value report is showing correct value but the OBIEE report with EVALUATE function shows incorrect value.
    The requirement is to create a OBIEE Dashboard from a Discoverer existing report. Now in discoverer report theere are several calculated items in worksheet level where database custom function is used and user selected parameter value is passed run time in that function. But when that is created in OBIEE with EVALUATE function in RPD, the report shows incorrect data. Could not understand how to pass the parameter value runtime.
    Below is the discoverer 'Show SQL' query and EVALUATE function syntax which has been used.
    SELECT APPS.XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(XXBG_PL_PROJ_AFE_V.AFE_ID,
    :"Period Name(AFE)",
    XXBG_PL_PROJ_AFE_V.DATA_SEL,
    XXBG_PL_PROJ_AFE_V.ORG_ID),
    XXBG_PL_PROJ_AFE_V.AFE_DESC,
    XXBG_PL_PROJ_AFE_V.AFE_NUMBER,
    XXBG_PL_PROJ_AFE_V.APPROVED_AFE_AMOUNT
    FROM APPS.PA_PERIODS_ALL PA_PERIODS_ALL,
    APPS.XXBG_PL_PROJ_AFE_V XXBG_PL_PROJ_AFE_V
    WHERE ((XXBG_PL_PROJ_AFE_V.ORG_ID = PA_PERIODS_ALL.ORG_ID))
    AND (XXBG_PL_PROJ_AFE_V.DATA_SEL = :"Data Selection(AFE)")
    AND (PA_PERIODS_ALL.PERIOD_NAME = :"Period Name(AFE)")
    AND (XXBG_PL_PROJ_AFE_V.AFE_NUMBER = :"AFE Number(AFE)")
    AND (XXBG_PL_PROJ_AFE_V.OPERATING_UNIT = :"Operating Unit(AFE)")
    The EVALUATE function syntax is as below:
    EVALUATE('XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(%1,%2,%3,%4)' AS FLOAT , "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Afe Id", "BG PL Project Analysis Report_1"."Periods 1"."Periods 1.Period Name", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Data Sel", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Org Id")
    The PERIOD needs to be passed at run time which user will select.
    Please help to solve the issue.

  • Modifying .PRM file for user defined database functions

    Hi,
    Currently we have the BOXI 3.1.8 Universe in oracle database and we are planning to migrate to SQL server 2008.And the universe contains few oracle functions and user defined functions in the universe objects.
    In the way of migration we are planning to have both Oracle and SQL Server database connecting to single universe. To make the universe generic we have identified the objects using user defined functions and trying to push it to the database.
    Since there are a few differences in the way oracle and SQL Server functions are invoked, we have decided to edit the .PRM files available in the path D:\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\jdbc , so that we have a common way of invoking the functions.
    Invoking functions:
    SQL Server : <SchemaName>.<function>
    Oracle: <function>
    1.Is there any problem if I edit the .PRM?
    2.Whether these changes will work fine?
    3.Whether the reports will run fine if I use those objects in the reports?
    Thanks,
    Lavanyaa

    Hi Lavanyaa,
    The PRM files actually state the functions that are normally available in a database, including the standard format.
    They are what drives the list of functions available when you build the SELECT definition or CONDITION definitions in Information designer... The fact that a function needs aggregation or/not is also determined in there.
    However:
    The SQL that you provide in the universe is what will be sent to the database and that must be 'understood' by the database.
    So it's not as simple as changing the PRM file and you will be able to speak 'universal' SQL in your universes.
    Fortunately:
    That complexity is taken away from you when you create a multisource database.
    You will speak 'data federator' SQL in the universe. Data federator will take care of translating it to the right syntax for each database. Notice you will probably need some customization to determine how a SQL will be handled when you need to query two databases, as the default is not automatically the best way performance wise.
    Hope this helps,
    Marianne

  • BIP SQL Query calling db function....

    Hi ,
    I am using SQL as my data model (Not Data Template).
    Can I modify my SQL query to include a database function .....eg
    select
    col1 ,
    col2,
    mypackage.myfunction(col2)
    from table_1
    Please let me know
    rgds
    s

    yes.
    don't forget to give me the points.
    Ike Wiggins
    http://bipublisher.blogspot.com

  • XSL Database Functions throwing "ORA-01000: maximum open cursors exceeded"

    In my BPEL process, I have a large dataset requiring enrichment of the data by looking up values in a database. I'm doing this in an XSL transformation using either; orcl:lookup-table() or orcl:query-database() functions. This works ok for a number of records, but then fails with "ORA-01000: maximum open cursors exceeded".
    This implies that these functions are not closing down open cursors after use. Is this a bug, or can I configure the data-sources to handle this?
    Thanks.

    I don't see any settings to fix this on the data-source itself.
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28988/trouble.htm#BABCBFHA
    4.11.2 ORA-00604: Error Occurred at Recursive SQL Level 1 ORA-01000: Maximum Open Cursors Exceeded
    If i see this..Oracle just advices just to set the PROCESSES parameter on the database high enough so it wont happen :)

Maybe you are looking for

  • Multiple text fields in Print Module

    Allow multiple text fields in Print Module with flexible editing.

  • Active creative cloud subscription but still showing trial?

    Hello, I currently have an active Creative Cloud subscription for Photoshop. I recently just wiped my PC (Windows 8.1 - custom build), and upon redownloading photoshop, it's asking for a serial number upon Photoshop launch when I use my log-in. I've

  • HP Officejet Pro 8600 e

    Hello everyone, I just bought a HP Officejet Pro 8600 e-All-in-One today from Staples.  I set everything and it all went well, I can print wirelessly from my laptop, it will do a B/W copy and color copy, but whenever I try to send a picture from my i

  • "Right-click" Adobe options not available anymore

    I used to be able to highlight multiple PDF files and right click and "combine into single PDF". That option is no longer available. Also when I try printing to PDF sometime it does absolutely nothing and says "error" Any help would be much appreciat

  • Need clarification on using the NodeFunctions in mapping

    Hi All, Can we use UseOneAsMany & Remove context functions in mapping of one field?? My requirement is, from Idoc one of the Header segment(E1ADRM1) will repeat 3 times with qualifier as "WE"   "AG"  & "AS". I have to mapp the NAME1 field of header s