Create a Procedure that will accept a variable

Hi,
I'm new to pl/sql and I'm trying to create a procedure that will accept a variable. I want to use this sql to create restore points that can store the name of each batch job as it runs.
The code works fine on it's own, but if I try to create the procedure it asks me for a value for 1, how do I stop it doing that?
CREATE OR REPLACE PROCEDURE create_restore_point AS
DECLARE
pointno number(5);
pointname varchar2(128) := upper('&1');
dbname v$database.name%TYPE;
scn_time date;
scn number;
BEGIN
SELECT restore_point_seq.nextval into pointno from dual;
SELECT name into dbname from v$database;
SELECT sysdate into scn_time from dual;
SELECT dbms_flashback.get_system_change_number into scn from dual;
INSERT into restore_point
values
(pointno,pointname,dbname,scn_time,scn);
commit;
END create_restore_point;
Many thanks in advance,
Tom.

It asks for value of 1 because you have &1 in your code. If you want to pass the value for pointname, then you can change your procedure like below.
CREATE OR REPLACE PROCEDURE create_restore_point (svar varchar2)AS
DECLARE
pointno number(5);
pointname varchar2(128) := upper(svar);
dbname v$database.name%TYPE;
scn_time date;
scn number;
BEGIN
SELECT restore_point_seq.nextval into pointno from dual;
SELECT name into dbname from v$database;
SELECT sysdate into scn_time from dual;
SELECT dbms_flashback.get_system_change_number into scn from dual;
INSERT into restore_point
values
(pointno,pointname,dbname,scn_time,scn);
commit;
END create_restore_point;

Similar Messages

  • How to create a program that will accept a series of strings of 0 and 1 onl

    how to create a program that will accept a series of strings of 0 and 1 only then displays 0 as 48 and displays 1 as 49.

    Isn't one thread enough for your homework?
    http://forum.java.sun.com/thread.jspa?threadID=5253850&messageID=10051155#10051155

  • I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".

    Hello,
    I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
    Suppose , 
    Parameter value : person 1,person2,person3 
    table structure : 
    Project Name | officers 1 | officers 2
    here, officers 1 or officers 2 may contain names of multiple people.
    expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2. 
    please explain or provide solution in detail 
    - Thanks

    Hi Visakh,
    Thanks for reply.
    But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
    Your solution is working fine for following scenario : 
    Project 
    Officers 1
    Officers 2
    p1
    of11
    off21
    p2
    of12
    off22
    with parameter : of11,off22 : it will give expected output
    And its not working in case of :
    Project 
    Officers 1
    Officers 2
    p1
    of11,of12
    off21,off23
    p2
    of12,of13
    off22,off24
    with parameter : of11,off22 : it will not give any row in output
    I need patten matching not exact match :) 
    ok
    if thats the case use this modified logic
    CREATE PROC GetProjectDetails
    @PersonList varchar(5000)
    AS
    SELECT p.*
    FROM ProjectTable p
    INNER JOIN dbo.ParseValues(@PersonList,',')f
    ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
    OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
    GO
    Keep in mind that what you've done is a wrong design approach
    You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Create a procedure which will pass table name as an argument

    Please let me know, I want to create a procedure which will take
    table name as an argument and will display total no. of rows of
    that table.

    Hopefully this code will help u.
    CREATE OR REPLACE PROCEDURE P1(TAB_NAME IN VARCHAR2, ROW_NO
    OUT NUMBER)
    AS
    SQL_STMT VARCHAR2(1000);
    BEGIN
    SQL_STMT := 'SELECT COUNT(*) FROM ' || TAB_NAME;
    EXECUTE IMMEDIATE SQL_STMT INTO ROW_NO;
    END;
    SQL > VAR A NUMBER
    SQL > EXEC P1('EMP',:A);
    SQL > PRINT A
    A
    12
    SQL > SELECT COUNT(*) FROM EMP;
    COUNT(*)
    12

  • Is it possible to create a bean that will generate (fill up) applet paramet

    Hi all,
    As a newbie I was asking myself is it possible to create a bean that will fill up applet parameter or directly generate the applet ??
    And I can I create it ?
    I mean : Having a jsp page that make reference to the bean, the bean shall generatehtml applet parameter values.
    Some samples will be welcome or a template.
    Thanks in advance
    Shamann

    Thanks a lot for your reply siv viv,
    I've posted this thread because I'm a little bit disappointed with Applet and jsp according to lot of thread about this subject (it seems that communication between applet and jsp is not easy : bug reported).
    The basic thing i want to do is to create a dynamic Pie Chart as applet or bean so i need to set applet parameter thanks to variables.
    See the http://forums.java.sun.com/thread.jsp?forum=45&thread=80250 this one is putting me in the dark.
    regards
    Shamann

  • I need to create a schedule that will be performed every day

    Hi,
    I need to create a schedule that will be performed every day. Must start at a specified time and finish their work at a certain time. Joby hooked to this schedule must do their work in a loop, until he completed the work to the procedure. Do you have any solution?

    6e4e5455-0183-4163-be68-1e68fc529042 wrote:
    Hi,
    I need to create a schedule that will be performed every day. Must start at a specified time [...]
    Easy, use DBMS_SCHEDULER to schedule the job to start at a particular time every day.
    [...] and finish their work at a certain time. [...]
    What should it do if it finishes early? What should it do if it hasn't finished its work by the given time? There may be things you can do to make it crash out at a given time - but its helpful to know what your aims are first.
    Joby hooked to this schedule must do their work in a loop, until he completed the work to the procedure. Do you have any solution?
    I don't have a clue what that last sentence means, let alone a solution.

  • OK, I need to be able to have a linked TOC, and also have destinations created in FM10 that will not be lost when I 1. Save the book as a PDF. then 2.  need the PDF to be as small as possible, but without losing my destinations. Anyone know how to do that

    OK, I need to be able to have a linked TOC, and also have destinations created in FM10 that will not be lost when I 1. Save the book as a PDF; then 2. I need the PDF to be as small as possible, but without losing my destinations. Anyone know how to do that??
    I had been saving as a PDF and then reducing the size of the PDF by printing it as a PDF with a degree of image compression. I write manuals with a LOT of screen captures and line art that needs to be clear. So it is a balancing act between image clarity and PDF size. The PDFs on the web need to be smaller - sure you can undertsand.
    Anyway, when I print the PDF again, I lose both my destinations and bookmarks.
    Anyone know of any way to avoid that?

    Control the images by creating a custom PDF Job Options and then selecting it in the PDF Job Options drop-down of the PDF setup dialog box (File > Save as PDF...)
    Create the custom PDF Job Options file with Distiller. If you do not have Distiller, open the Printing Preferences of the Adobe PDF printer. Start with the Smallest File Size Job Options settings and Edit.

  • How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?

    How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?
    I currently run OS X 10.10.1
    Now i have been trying to work on this for a while now and what i want to do should be simple but its apparently not.
    Here is an example of what i want to happen.
    I will have 2 tabs: Contact | Sales
    Now Contacts will have the list of names and various information about a customer, While Sales will have one drop-down box for each Cell Row that will show the names of the person in tab contacts
    for what i am wanting to do i cant use the data format pop-up menu because the list is edited everyday several times a day.
    Now how do i do this, Excel can do this so how can numbers do it?

    Hi Shegra,
    Paste this into a applescript editor window and run it from there. In the script you may need to adjust the four properties to agree with your spreadsheet. Let me know if you have any questions.
    quinn
    Script starts:
    -- This script converts column A in one table into an alphabetized list of popups. It copies the last cell in that column. Then reverts the column to text. It then refreshes popups in column A of a data table starting with a user defined row.
    property DataEntrySheet : "Sheet 1" --name of sheet with popups to be refreshed
    property DataEntryTable : "Sales" --name of table with popups to be refreshed
    set copyRange to {}
    property PopValueSheet : "Sheet 1" --name of sheet with popup values table
    property PopValueTable : "Contacts" --name of table with popup values
    set PopStartRow to {}
    tell application "Numbers"
      set d to front document
      set ps to d's sheet PopValueSheet
      set pt to ps's table PopValueTable
      set s to d's sheet DataEntrySheet
      set t to s's table DataEntryTable
      set tf to t's filtered --this records filter setting on data Entry Table
      display dialog "Start from row #..." default answer "" with icon 1 -- with icon file "Path:to:my.icon.icns" --a Week # row
      set PopStartRow to {text returned of result}
      tell pt --convert list to alphabetized popups
      set ptRows to count rows
      set copyRange to ("A2:" & name of cell ptRows of column "A")
      set selection range to range copyRange
      set selection range's format to text
      sort by column 1 direction ascending
      set selection range's format to pop up menu
      -- popupsmade
      set selection range to cell ptRows of column 1 of pt
      set v to value of cell ptRows of pt
      end tell
      activate application "Numbers"
      tell application "System Events" to keystroke "c" using command down
      tell pt
      set selection range to range copyRange
      set selection range's format to text
      end tell
      tell t
      set filtered to false
      set tRows to count rows
      set pasteRange to ((name of cell PopStartRow of column "A") & ":" & (name of cell tRows of column "A"))
      set selection range to range pasteRange
      tell application "System Events" to keystroke "v" using command down
      set filtered to tf
      end tell
    end tell

  • Having stopped audio with a swf inside a sidelet can someone create a swf that will resume the audio

    Ok, rick is going to post the fla of this file and I will
    post the swf. Basically this is all about having a slide that has
    audio running all the way through and enabling the user to roll
    over a sidelet and have the video and audio stop playback.
    At present, the max you can achieve is, to stop video. The
    audio keeps going and of course everything gets out of
    sync. Rick has create a swf that you input into a sidelet (
    after having imported your image or video ) which stops the audio.
    Fantasitc. Unfortunatly he was not successful in creating a swf
    that will resume the audio.
    So there is the mission. To create something that will resume
    the audio, be it a swf inside the sidelet or something else.

    Hi there paul. Am I right in thinking that your code will
    mute the audio. In my situation this would cause problems becasue
    you would roll over the sidelet - the audio would go silent and
    when you rolled off, or resumed the audio, it would have been
    playing so again the video and audio will be out of sync.
    Rick - rather than another swf which would activate the audio
    and video when you roll off the sidelet ( while that is the perfect
    solution ) what about looking at a button the user can press to
    resume things, maybe Im wrong but that sounds a little easier.
    ( however for all those reading this that is not really the
    solution I am looking for, what Im looking for is the above
    solution where you can just roll off and on and so on )

  • Create a contact that will dial an external conference and enter a pin, using Lync

    Greetings!
    Let me describe a scenario.
    On my cellphone, I can create a contact that will dial an external conference number that is not a Lync Meeting, insert a pause (with commas) enter a pin with a # at the end, because that particular conference system asks for pin followed by #.
    The phone number for that contact on my phone is   18005551212,,,,1234#
    Is there a way to do something similar to a Lync contact? or, as an Outlook contact that will pause and then enter the pin chars?
    Well, thanks very much for reading my question!

    Landis said no a while back:
    http://social.technet.microsoft.com/Forums/lync/en-US/794fb7a5-f55e-4ca7-8f2e-d6264d7607f0/lync-conference-id-automatic-dialing?forum=ocsclients 
    And I don't believe that's changed.  Effectively, the number you typed for the contact isn't what's sent.  That gets normalized into what's sent.  I think the only way to send pauses between DTMF is manually through the dialpad.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications

  • Create a window that will always ontop

    pls am having a problem creating a window that will always on top such that it cannot be minimized that cannot go to the background ,will always be on top like the task manager in windows
    help meeeeeeee!!!!!!
    my email:[email protected]

    http://forum.java.sun.com/thread.jsp?forum=57&thread=121761
    Try searching the forums, this has been asked many times before.

  • Firstly hello to all. I'm looking to create a vi that will take a single logged output from a thermocoup​le and monitor the temperatur​e and produce a Boolean when the temperatur​e has stabilised for a pre determined time say 1minuet.

    Firstly hello to all. I’m looking to create a vi that will
    take a single logged output from a thermocouple and monitor the temperature and
    produce a Boolean when the temperature has stabilised for a pre determined time
    say 1minuet. I have managed to find a couple of examples on the forum but one
    will only run on V8.2 and I have V8, the other is for more than one channel
    witch is fine I can always reduce this, but it was the timing feature I was
    having difficulty with. I looking to monitor the temperature of a motor until
    it has stabilised prior to testing and then to use this temperature as a
    reference. Pleas forgive my ignorance if this is a very simple thing but I’ am
    learning and really enjoying it. Thank you in advance for your answers.

    Hi
    Graham, thank you for you reply.
    What I’ am trying to achieve is a vi I can use in a motor
    testing setup, a part of this would be to warm the motor up until the exhaust
    air temperature has stabilised, this takes approximately 10 minuets. I was
    thinking of just letting the motor run for this time and leave it at this, but
    some motors warm up quicker that others and. I am basically looking for a vi with
    an adjustable temperature window of say ±5 C° in 1° increments, timing wise 1minuet
    to 10min the adjustment is so I a can use this for another application. I tried
    to adjust the code I found at the link below but had a little difficulty with
    the timing. Thank you so much for your help it’s much appreciated.
    sine.ni.com/niforum/niforum?forumDU=http://forums.​ni.com/ni/board/message?board.id=170&message.id=25​1017&requireLogin=False

  • I need instructions on how to create a button that will email a pdf form to someone else on a websit

    I NEED ASSISTANCE CREATING A BUTTON THAT WILL EMAIL A PDF FORM FROM A WEBSITE TO WHOEVER THE VIEWER WANTS TO

    Just a bit more info. E-mail can be used, but has potential problems -- often related to the client machine that you have no control over. Use the data submissions (either FDF or XML) rather than the full PDF so you do not have to deal with Reader Rights and the related license issues. The FDF and XML data files are easily imported into the original form so that you see what the client sees. With those aspects in mind, just go ahead and try one. Be aware that you can add form fields using the form tools in the Advanced Editing tools, OR use the forms menu that will take you to Designer. You might want to try both to see the pros and cons. Be sure to keep such a test simple so you are not wasting time on your final form just for testing. I typically create a 1 page form that has all of the possible fields for such a test.

  • How to create a form that will allow the applicant to upload their photo

    I have Adobe Acrobat 9 Pro Extended and I know how to create forms that require text input.
    How to create a form that will allow the applicant to upload their photo? I alo wish to know how to upload a photograph so that I can test the form I created.
    Thank you
    Adrian Watts

    test@ORA10G> with x as (
      2    select '234-1111' as customer, to_date('2-Jan-2008','dd-Mon-yyyy') as call_date, 'Order product' as reason from dual union all
      3    select '234-1132', to_date('3-Jan-2008','dd-Mon-yyyy'), 'Request info' from dual union all
      4    select '231-1154', to_date('4-Sep-2007','dd-Mon-yyyy'), 'Request info' from dual union all
      5    select '234-1111', to_date('2-Nov-2007','dd-Mon-yyyy'), 'Order product' from dual union all
      6    select '234-1132', to_date('9-Jan-2008','dd-Mon-yyyy'), 'Request info' from dual union all
      7    select '231-1154', to_date('9-Sep-2007','dd-Mon-yyyy'), 'Request info' from dual union all
      8    select '234-1111', to_date('5-Dec-2007','dd-Mon-yyyy'), 'Order product' from dual union all
      9    select '234-1131', to_date('7-Dec-2007','dd-Mon-yyyy'), 'Request info' from dual union all
    10    select '231-1154', to_date('1-Sep-2007','dd-Mon-yyyy'), 'Request info' from dual union all
    11    select '234-1111', to_date('8-Jan-2008','dd-Mon-yyyy'), 'Order product' from dual union all
    12    select '234-1131', to_date('3-Dec-2007','dd-Mon-yyyy'), 'Request info' from dual union all
    13    select '231-1154', to_date('4-Nov-2007','dd-Mon-yyyy'), 'Forward to Sales' from dual)
    14  --
    15  select customer,max(call_date), reason
    16  from x
    17  where reason = 'Request info'
    18  group by customer, reason;
    CUSTOMER MAX(CALL_ REASON
    231-1154 09-SEP-07 Request info
    234-1131 07-DEC-07 Request info
    234-1132 09-JAN-08 Request info
    test@ORA10G>
    test@ORA10G>pratz

  • How to create an action that will crop two sections from one scanned image?

    I'm trying to create an action that will automate the process of cropping the left and right pages from a series of two-page book scans.
    I tried to create a 2 step action which first crops the left half of a scan (by setting the left margin to 0in and the right margin to 6in) and then the right half of the scan (by setting the left margin to 6in and the right margin to. 12in), however when executing, only the left half appears to be cropped.
    I imagine this is due to the fact that once one side of the initial scan is cropped, the other side disappears.
    Is there any way around this?

    Basically i need to create a new document out of a folder full of images.
    You may have to look into Scripting to achieve something like this.
    You could ask in the Scriptimg Forum
    Photoshop Scripting
    But maybe it would suffice to insert the Menu Item
    File – Scripts – Load Files into Stack
    into the Action and then iterate through the Layers with [ or ] and reset the opacities and Blend Modes – but as Actions would not be able to change the number of repetitions of the operation conditionally a custom Script would still seem preferable. 

Maybe you are looking for

  • I cannot reinstall Adobe Acrobat 9.

    I have tried to reinstall Adobe 9 several times.  All I get is error 130:3 and references to licensing errors.  How can I get this program to work?

  • Master-detail form in HTML DB

    Is there any way to create a master form with multiple detail tabs on the same page? This can be easily done in Oracle Forms by creating a master block and several child blocks on the same form. Thanks.

  • How can I install facebook on iPhone3?

    how can I install facebook on iPhone3

  • Tree control and drop target data

    Hi I can't seem to find an answer to my problem anywhere. Is it possible to read the data from the node over which an item is dragged and accept or reject a drop if for example the node data has attribute droppable? Attached is the ArrayCollection us

  • Unable to edit Flash file - Can't enter inside buttons/movie clips.

    Hi I am in the middle of creating a website using Flash CS5. I opened up my .Fla file one day to continue my work but I am no unable to access buttons and movie clips. When creating movie clips or buttons I am unable to get inside them, when I hover