PLSQL FUNCTION (variation of earlier question)

-- Attempting to COMBINE two parts of
-- a table name using a function
-- 1. MANY tables begin with the string: -- FT
-- 2. each suffixed two digits refer to the -- year of
-- the data in the table
-- eg. TABLE FT99 includes all 1999 -- data
-- how can I fix this ?
-- is this a bad approach to the problem ?
create or replace function gca_f1 return varchar2 as
begin
return('ft'| |'&&yr1');
end;
variable pvl1 varchar2(10);
execute :pvl1 := gca_f1();
column p new_value p1;
select :pvl1 p1 from dual;
prompt this works up to this point
-- the following does pass the correct file -- name
select count(*) from &&p1;
null

-- x.sql WORKS ! BUT ... I DON'T UNDERSTAND.
-- WHY MUST {fun_var1} BE LOADED INTO {col2}
-- TWO TIMES TO GET A VALUE FROM {fnctn1} TO -- WORK ?
-- WHAT AM I MISSING ?
CREATE OR REPLACE FUNCTION fnctn1 RETURN VARCHAR2 AS
BEGIN
RETURN('ft'| |'&&yr1');
END;
VARIABLE fun_var1 VARCHAR2(10);
EXECUTE :fun_var1 := fnctn1();
-- FIRST TIME
COLUMN col1 NEW_VALUE col2;
SELECT :fun_var1 col2 FROM DUAL;
-- SECOND TIME
COLUMN col2 NEW_VALUE col3;
SELECT :fun_var1 col2 FROM DUAL;
SELECT COUNT(*) FROM &&col3;
-- NOTES:
-- This function combines two parts of a -- table name
-- 1. Tables begin with string: FT
-- 2. Suffix is two digits for: year
--eg. table FT99 includes data for 1999
null

Similar Messages

  • Unexpected problem with authorization scheme of type plsql function

    Hi,
    I have created one authorization scheme of type plsql function returning boolean. Authorization scheme is for pages only. p2_user_priviledge is a textbox on home page which extract privilege (list of pagenos) for login user from database. Home page has no authorization required. AUTHORIZATION SCHEME always returns false. I am not able to trace problem in my code. same code works fine for a textbox's default returning 'c'.
    ----- CODE FOR AUTHORIZATION SCHEME------------------------------------------------------------
    declare
    pageid varchar2(10);
    privilege varchar2(300);
    c number(3);
    begin
    pageid := ':P'||to_char(:app_page_id)||':' ; ---Pageno get stored in format  *:P2:*
    privilege := trim(:p2_user_priviledge); ++------Contain list of privilege like    :P2:P13:P67:P23:  etc+++ select instr(privilege,pageid) into c from dual;
    if c>0 then
    return true;
    else
    return false;
    end if;
    end;
    One more problem is again related to authorization scheme.
    I created one application and one authorization scheme (auth_aug) which worked finely. Then after some days i added 10 more pages to same application, But now autho_aug was always returning false for new pages. So i copied code from 'autho_aug' to new scheme 'autho_sept', & it worked for new pages. I don't understand if code is same for both scheme, why required to use two different schemes.
    Now i have added few more pages to application, and facing problem mentioned earlier.
    any solution for both the problems.....

    Hi,
    Let me clear my problem once again.
    -->Home page i.e. P2 does not use authorization, So it is displayed along with text item :p2_user_privilege.
    -->Then user click on one of the links , Now page :P70: should get displayed.
    P70 is using authorization scheme.
    -->But :p2_user_priviledge value is not accessible at authorization scheme, I dont know why.
    I could not find out where to create Application item , as suggested by you.
    & not able to find Developer menu , session at home page as suggested earlier.
    And one more question, my application at runtime display
    X en us
    at bottom
    How to make it
    USER: X Language: en us
    Like in development environment.
    Hope I have cleared my problem, waiting for reply.
    Edited by: TEJU on Nov 17, 2008 9:25 AM

  • Error in plsql function

    Hi Friends,
    I have the below plsql function which is throwing error.
    The below function is written in Apex, so kindly let me know ow to resolve this error
    The below query checks the existing value and if null assigns a value by select statement. else will assign it back to the variable.
    Function:
    BEGIN
    IF
    :P1_VARIABLE_NAME IS NULL THEN :P1_VARIABLE_NAME:=select .... from .... (which returns a string value)
    ELSE
    :P1_VARIABLE_NAME
    END
    END
    Error:
    Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe

    Pradeep wrote:
    No I am creating a PLSQL function body option to write the above query. Is there a way in apex to dynamically bind the valueApex function bodies support bind variables. For example, you can set the rendering condition of an Apex region to a function body and code it as follows:
    if :P1_SOMEVAR = MySchema.MyFunction( :P1_SOME_OTHERVAR ) then
      return( true );
    else
      return( false );
    end if;Where the bind variables used are standard Apex page item (variables).
    I also suggest that if your questions are Apex related and not specifically PL/SQL and SQL language related, you rather ask your questions in the OTN Apex forum and not here.

  • Plsql function to return period and yr values

    Hi All,
    I have a requirement to develop a function
    which will accept any date and return the two values period, yr
    as follows
    if date is 1st oct 2011 then period should be 1 yr should be 2012
    if date is 1st nov 2011 then period should be 2 yr should be 2012
    if date is 1st dec 2011 then period should be 3 yr should be 2012
    if date is 1st jan 2012 then period should be 4 yr should be 2012
    if date is 1st feb 2012 then period should be 5 yr should be 2012
    if date is 1st mar 2012 then period should be 6 yr should be 2012
    if date is 1st apr 2012 then period should be 7 yr should be 2012
    if date is 1st may 2012 then period should be 8 yr should be 2012
    if date is 1st june 2012 then period should be 9 yr should be 2012
    if date is 1st july 2012 then period should be 10 yr should be 2012
    if date is 1st aug2012 then period should be 11 yr should be 2012
    if date is 1st sept 2012 then period should be 12 yr should be 2012
    if date is 1stoct 2012 then period should be 1 yr should be 2013
    if date is 1st nov 2012 then period should be 2 yr should be 2013
    if date is 1st dec 2012 then period should be 3 yr should be 2013
    and so on
    Please tell me how can i achive these through a plsql function
    Thanks in anticipation.

    Hi,
    This forum is for questions using SQL*Developer, not for general PL/SQL questions.
    It would be better to ask this question in the SQL and PL/SQL forum -
    PL/SQL
    Regards,
    Mike

  • Need to join the two xml type output in plsql function

    Hi,
    I need to join the two xml type output in plsql function. Could you help me out?
    Sample function:
    function func_ret_stk return xmtype
    xmloutput_stk xmtype;
    xmloutput_desp xmtype;
    begin
    xmloutput_stk := --------;
    xmloutput_desp :=---------;
    return xmloutput_stk + xmloutput_desp;
    end ;
    Thanks in Advance,

    Hello,
    this is the forum for the tool {forum:id=260}.
    Please ask your question in {forum:id=157} or {forum:id=34}
    Regards
    Marcus

  • Earlier Questions from 2006-2008

    Hi all
    I am member since 2006. In my control panel I see questiones posted in 2009 and I am able to trace earlier questions from 2006 to 2008 which were defnitely more than 20 questions with around 90 posts in total.
    I tried to search by "Suresh Bansal", still I could not find my earlier questions. They had useful tips and remarks.
    Previous interface allowed to access all earlier questions at any time. Kindly guide as to how find our earlier questions
    Suresh Bansal

    If you are referring to search by "user ID" functionality, I recall having read some threads in the feedback forum. You could try looking up those.
    AFAIK, it does not work since the Jive upgrade done last August.
    Your only option is to scroll through all the threads that are listed under your name.
    Edited by: Satish Kandi on Aug 20, 2009 2:26 PM
    Option added.

  • Error while trying to access a SSWA PLSQL function

    Hi,
    I am trying to access a report as a web page by defining the function as follows :
    Type : SSWA PLSQL FUNCTION
    HTML Call : OracleOASIS.RunReport
    Parameters : report=EMPDET
    This function is attached to the menu and when I try to access the page I get this error.
    "Error: The requested URL was not found, or cannot be served at this time.
    Incorrect usage."
    The URL that shows in the page is as follows(<server:port> I removed the server name and port) :
    http://<server:port>/dev60cgi/rwcgi60?GDEV_APPS+DESFORMAT=HTML+SERVER=GDEV_APPS+report=EMPDET+p_session_id=A9C71A70B9B1D9BD2DCC0FC3AF9BC324+p_user_id=1133+p_responsibility_id=50230+p_application_id=800+p_security_group_id=0+p_language_code=US+NLS_LANG=AMERICAN_AMERICA+NLS_DATE_FORMAT=DD-MON-RRRR+NLS_NUMERIC_CHARACTERS=.%2C+NLS_DATE_LANGUAGE=AMERICAN+NLS_SORT=BINARY+paramform=NO
    Surprisingly other functions which are defined in this manner work fine. Do I need to register my report anywhere or are there any other settings I need to do for the report to show up.
    Can someone let me know.
    Thanks

    Hi ;
    pelase check below which could be similar error like yours
    Troubleshooting of Runtime Errors of Customer Intelligence Reports [ID 284829.1]
    Regard
    Helios

  • How can I call a plsql function from an attribute?

    I have an attribute defined in an element. I want execute a PLSQL function from the attribute, and display the returne value with an HTML template.
    I've defined the attribute's type like PLSQL, and I've put the called of the function in the value of the attribute, but it doesn't work. The only value I obtain is an URL (I think that is the URL of the function or someting like this).
    How can I call to my function from the attribute and display the returnes value in the page?
    Thanks.

    Thanks, but it doesn't work. I have an attribute called ID_BOL and I want to associate a sequence to that attribute. I've created a function, with the sequence. This function return de value of the sequence. I want taht the attribute takes the value of the sequenece dinamically.
    I've tried it, creating the type attribute like PLSQL, and calling the function from the attribute, but it doesn't work.
    How can I return the sequence value to my attribute?
    Thanks.

  • This is a continuation of my earlier question.  The CDs are burning with a .cda or .cdda format  I read the articles suggested, but I don't yet have an answer.  The files I am trying to burn are not protected.  They are personal recordings.

    The CDs are in a .cda format.  I am starting with .AAC or mp3.  I have no player that can handle a .cda or .cdda format.  This relates to my earlier question.  I could not see how to add to that.  I am using Vista 32 bit.  I never had a problem with this before.  I tried re-downloading itunes.  I can burn a CD with Power2Go 8 and RealPlayer.  I have not tried others.

    There is no "cda format" - this is just how Windows Explorer shows the tracks on an audio CD that can be played on any CD player.  When you use iTunes to burn a playlist to an audio disc, it creates a standard "Red Book" disc, converting the format of the files within the iTunes library to 16/44.1 audio (albeit without recovering any of diminished quality of mp3 or aac data).  If you want to create a CD that contains the files from iTunes, in the format in which they exist in the library, you should use the MP3 CD or Data CD selection from the iTunes Burn Settings dialog.

  • Lack of flexibility in the format PLSQL functionality

    Hi,
    Is there any plans to increase the functionality of the format PLSQL function? Compared to TOAD, it is extremely limited. The TOAD formatter alone is enough to keep our organization from switching to SQL Developer.
    Darryl

    You got that in bold: it's announced on this forum and on sqldev's homepage... http://htmldb.oracle.com/pls/otn/f?p=42626:37:260789750723810::NO:::

  • How to create SSWA plsql function in Oracle Apps of HTML call .html

    Hello Team,
    I am working on Oracle Apps 11i (11.5.10.2)
    I want to know , what is the process to create a , "SSWA plsql function" in Oracle Apps of type "HTML" and html call tab.
    How to create that Function and how to attach the PL/SQL code to these functions.
    How it works.
    Please help me to understand this concept from basics.
    Kind Regards

    Hi;
    Please review:
    how to setup a forms function in R12 to launch an URL?
    http://www.trutek.com/serendipity/index.php?/archives/15-An-Example-of-How-to-Create-Custom-Functions,-Menus,-and-Responsibilities.html
    Regard
    Helios

  • How to register database plsql function in obiee

    Hi,
    I've a database plsql function which accepts two date arguments - StartDate and EndDate and return Integer.
    I discoverer like we've Plsql function registration tool, where we import function and pass parameter values as arguments in report- how same can be done in Oracle BI Administration tool and BI Answers?
    I tried to create logical column as
    EVALUATE('YOUR_FUNCTION(%1, %2, %3, %4)' as varchar(20),@{p_1},@{p_2},@{p_3},@{p_4})
    it is giving syntax error.
    url: How to store OBIEE presentation level variable values in DB
    Please help. It is really urgent.
    Kind Regards.

    Hi,
    I created 2 session variables p_startym and p_endym of char datatype and called in function(name: RepInitDates). It looks like:
    EVALUATE('INIT_DATES_MONID(%1, %2)' AS INTEGER , VALUEOF(NQ_SESSION."p_startym"), VALUEOF(NQ_SESSION."p_endym")).
    Now I've presentation variables StartMonth and EndMonth in bi answers report, whose value i want to pass to p_startym and p_endym. What should be the syntax of Bi answers column? Please reply.
    Thanks

  • Problem in Importing PLSQL functions

    Dear Friends,
    I am facing a problem in Importing the PLSQL functions which i have created, Please refer to the following steps :
    1) I created the function and gave execute grants to EUL_US .
    2) I tried to import the function from Discoverer administrator, but i am unable to find the function in the list.
    Please advice wethere i missed any step..
    Thanks in advance
    Raj

    Hi
    Yes, i tried that. Please verify the following steps i did:
    1) created <mypack.myfunc> under apps user
    2) Grant all on <mypack.myfunc> to EUL_US with grant option;
    It contains two parameters :- id number, as_on_date date
    I tried to import in Discoverer admin, but i couldn't find it. Then i tried to register manually, i gave all options correctly, but it says invalid function.
    Did i miss any thing any where??
    Please help
    Thanks
    Raj

  • This relates to an earlier question I asked:  I have an iPhone and can send messages to a galaxy phone but the person cannot receive them; however, I can send them and it sounds like they are sent, but are not received.  I can get them from a galaxy.

    This relates to an earlier question I asked:  I have an iPhone and can send messages to a galaxy, but the person cannot receive them; however, I can receive messages from the galaxy.  I have only had an iPhone so the problem does not relate to a change in phones.  Up until about 1month ago I could send to the galaxy and they could be read.  Help!

    Hi there nancyfrompilot mountain,
    You may find the troubleshooting steps in the article below helpful.
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    If the issue occurs with a specific contact or contacts, back up or forward important messages and delete your current messaging threads with the contact. Create a new message to the contact and try again.
    If the issue occurs with a specific contact or contacts, delete and recreate the contact from the Contacts app. Send a new message to the contact.
    Back up and restore your iPhone as new.
    -Griff W. 

  • Call plsql function from esb-xsl mapping

    Hi
    I want to call a plsql function that takes an inparameter from an xsl mapping file.
    I tried to use the orcl:query-database function for this, but i couldn't get it to work when I wanted to dynamically pass the value of the inparameter to the function taken from the XML file used as input in the xsl transformation:
    If I hardcode the parameter value like this, it works fine:
    orcl:query-database('select emx_parameters.get_parameter_value('DEADLINE') result from dual',false(),false(),'jdbc/DB')
    But if i dynamically want to assign the inparameter, it doesn't work for me:
    orcl:query-database('select emx_parameters.get_parameter_value('/Header/ParameterName') result from dual',false(),false(),'jdbc/DB')
    Maybe it has something to do with the ' signs, but I tried a lot of combinations it nothing worked for me.
    Has anyone any ideas how to do this?
    Thanks
    Kalle

    Hi
    If anyone is interested i managed to solve it this way:
    I build up the sql query string with xsl variables like this:
    <xsl:variable name="start">select emx_parameters.get_parameter_value('</xsl:variable>
    <xsl:variable name="param" select='/Header/ParameterName'/>
    <xsl:variable name="end">') result from dual</xsl:variable>
    <xsl:variable name="expr" select="concat($start,$param,$end)"/>
    And then I called the orcl:query-database method with the variable as in-parameter.
    orcl:query-database($expr,false(),false(),"jdbc/DB")
    Maybe there is another way, but this worked for me.
    //Kalle

Maybe you are looking for

  • Time capsule losing internet connection

    Hey there, I've read other people with similar issues, but haven't found a solid resolution yet. Hoping you awesome Mac folks can help me out. It's slightly confusing, but please let me know what you think. Sorry this is long, just trying to give the

  • Error when adding image in-line with text

    When using some of my templates I have no problem in putting a small graphic (a pdf icon) in-line with text. Yet with others the insertion of the same small graphic forces a newline before and after the graphic. If the text and image is placed in an

  • Java Script errors in Dreamweaver MX 2004

    After disabling some of the extensions through "manage extensions", various javascript errors have shown up, disabling some features. For example, if I click on Manage Extensions, the javascript error is: " In the file manageExtensions, The following

  • Import and export in Region BAPI

    Hi, I am trying to ecute Region Bapi, it has import parameter as Country code once user selected this i have to pass this to bapi to dispaly region code and region Name say US is country code this is import parameter this i have to pass it to bapi an

  • Itunes store will not open when itunes is started

    New Iphone 4.  Wouldn't run on old Itunes version.  Downloaded itunes 10.5 and locks up when opening the Itunes Store.  Music accessible from old files, but no Store therefore cannot download IOS5 for the phone.  Have tried uninstalling multiple time