Create sequence, function and view all at once -script or something similar
Hi I would like to know in what way can I write a script or something like that which would define names for a sequence, function and a view in the beginning (for example TEST_SEQ, TEST_FJ, TEST_VIEW...) and after that create this sequence, function and view with definitions like
CREATE SEQUENCE TEST_SEQ
MINVALUE 1 MAXVALUE 999999999999999999999999999
INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE;
create or replace FUNCTION TEST_FJ RETURN NUMBER AS
tmp number;
BEGIN
select TEST_SEQ.NEXTVAL into tmp from dual
RETURN tmp;
END TEST_FJ;
and so on...
In the end I would also like to grant some rights on these objects I just created:
grant select on TEST_SEQ to public;
grant execute on TEST_FJ to public;
So my question is how to package all these things together so I can execute them from a single file in SQL Developer, and if i need to change the names of these tables I want do it in one place in the beginning of this script (or something like a script, I'm not sure what)...
Thanks in advance!
hi,
hope help you...
this is my basic generic solution...
create or replace procedure createSequence( psequenceName in varchar2 ) is
begin
execute immediate 'create sequence ' || psequenceName ;
execute immediate 'grant select on ' || psequenceName || ' to public ';
end ;
create or replace function getNextVal( psequenceName in varchar2 ) return number is
queryText varchar2(100) := 'select <sequence_name>.nextval into :next_value from DUAL' ;
next_value number ;
begin
queryText := replace(queryText,'<sequence_name>',psequenceName);
execute immediate queryText into next_value ;
return( next_value ) ;
end ;
Edited by: edogt on Nov 27, 2008 5:33 AM
Edited by: edogt on Nov 27, 2008 5:35 AM
Edited by: edogt on Nov 27, 2008 5:35 AM
Similar Messages
-
How can i move video and music and narration all at once in the project library
how can i move video, narration and music all at once in the project library it is only moving the video
Select the directory with your pngs in it.
Right-click>Browse with Adobe Bridge
Select your pngs
Tools>Photoshop>Load to photoshop layers (not sure how many layers this can handle--you may wind up having to do this in batches)
Save your new psd
In Flash, create a new symbol with a blank timeline
Ctrl-R, navigate to the psd you made earlier
Select all the Photoshop layers
Check "create MovieClips for these layers."
Convert layers to keyframes or flash layers (not important, since you probaby don't need to keep this symbol)
OK
You'll have Movie Clips, not Graphic Symbols, but maybe you can write or find a JSFL to convert them and then you can block select them, click the Properties button, and change the type from MovieClip to Graphc. -
How to create business functions and expose as webservice?
Hi...
How to use Java to create business functions and expose that as a webservice.Hi Leela,
Can you please post the answer to the question posed?
We are also looking for a similar implementation in our integration and would really appreciate any help.
Regards -
Since installing Lion, no Finder window will open on the desktop. I can see them through "Quick Look" and "View all Windows" in the contextual menu for Finder in the dock.
Help please!
-
What are the best editing softwares to create sequence shots and slow down video?, What are the best editing softwares to create sequence shots and slow down video?
Do you want free or do you want the best, your original post said best, now you are saying free. This is a contraction, there is no such thing as best free. There is such a thing as free and such a thing as best.
Also is your focus video or photos????? -
How to create an Area and place main windows in scripts
How to create an Area and place main windows in scripts ?
hi prasad,
jst create a page first and define page windows.
here u can specicify whether the window is main or secondary.
to adjust the window goto form painter do the adjustment. -
I had restore my nano and the language ended up chinese or something similar - need to change to english
iPod Manuals
-
About runtime sequence creation and view dare pre commmit.
Dear All,
My 2 New Question are:
1)Could Oracle suggest to create sequence(DDL) from run-time.That means I need(My client requirement) regenerate of sequence(I know it is possible by cycle but i don't know MAX value when it will cycle)as monthly or a specific time so I want to drop sequence and create sequence by a)Programmetically runtime
b) Oracle scheduler runtime .
Have any good and better Idea? Any risk factor?
Note that at a time possibly more than 100 users will data entry with our software.
2)My New query is Could I view table data which was not yet COMMITTED from other session-other user.
Regards and Thanking you,
ZAKIR
Analyst ,
SynesisIT,
www.Synesisit.com
=====I tried that, but there are too many trouble.
For only references.
-- Usage
Procedures
execute periodic_seq.seq_def create sequence
execute periodic_seq.seq_undef drop sequence
Functions
periodic_seq.nextvalue
get nextval of specified sequence
periodic_seq.currvalue
get currval of specified sequence
seq_def
in_seq_name varchar2 (30)
sequence name (current schema)
in_trunc_unit varchar2
'yyyy','mm','dd','hh24','mi' : format on trunc(date)
seq_def
in_owner varchar2 (30)
schema name
in_seq_name varchar2 (30)
sequence name
in_trunc_unit varchar2
'yyyy','mm','dd','hh24','mi' : format on trunc(date)
incr_by integer (default:1)
increment by
start_with integer (default:1)
start with
maxvalue integer (default:to_number('1e27'))
maxvalue
minvalue integer (default:1)
minvalue
cycle varchar2 (default:'N')
'Y':cycle/'N':nocycle
cache integer (default:20)
cache
time_order varchar2 (default:'N')
'Y':order/'N':noorder
seq_undef
in_seq_name varchar2 (30)
sequence name (current schema)
seq_undef
in_owner varchar2 (30)
schema name
in_seq_name varchar2 (30)
sequence name
nextvalue
in_seq_name varchar2 (30)
sequence name (current schema)
nextvalue
in_owner varchar2 (30)
schema name
in_seq_name varchar2 (30)
sequence name
currvalue
in_seq_name varchar2 (30)
sequence name (current schema)
currvalue
in_owner varchar2 (30)
schema name
in_seq_name varchar2 (30)
sequence name
-- Source --
-- Control table
create table cycle_seq_ctrl
(sequence_name varchar2(30) not null
,min_value integer
,max_value integer
,increment_by integer not null
,cycle_term varchar(10) default('dd') not null
,last_number integer not null
,reset_time date
,prev_nextval integer not null
,constraint pkey_cycle_seq_ctrl primary key (sequence_name)
organization index
create or replace
package cycle_seq
authid current_user
is
function nextvalue
(seq_name varchar2
,in_date date := sysdate
) return integer
function currvalue
(seq_name varchar2
) return integer
procedure seq_def
(seq_name varchar2
,cycleterm varchar2 := 'DD' /* Defaults : reset by a day */
,incr_by integer := 1
,start_with integer := 1
,maxvalue integer := to_number('1e27')
,minvalue integer := 1
procedure seq_undef
(seq_name varchar2
end; -- package cycle_seq
create or replace
package body cycle_seq
is
type currval_tab_type is table of integer index by varchar2(30);
currval_tab currval_tab_type;
function nextvalue
(seq_name varchar2
,in_date date := sysdate
) return integer
is
pragma autonomous_transaction;
timeout_on_nowait exception;
timeout_on_wait_sec exception;
pragma exception_init(timeout_on_nowait, -54);
pragma exception_init(timeout_on_wait_sec, -30006);
p_seqname cycle_seq_ctrl.sequence_name%type;
p_ctrl cycle_seq_ctrl%rowtype;
p_currtime date;
p_nextval integer;
begin
p_currtime := in_date;
p_seqname := upper(trim(seq_name));
select *
into p_ctrl
from cycle_seq_ctrl
where sequence_name = p_seqname
for update wait 1
if (p_ctrl.cycle_term<>'SS') then
p_currtime := trunc(p_currtime,p_ctrl.cycle_term);
end if;
-- need to reset
if (p_ctrl.reset_time < p_currtime) then
if (p_ctrl.increment_by > 0) then
p_nextval := p_ctrl.min_value;
elsif (p_ctrl.increment_by < 0) then
p_nextval := p_ctrl.max_value;
else
p_nextval := p_ctrl.last_number;
end if;
update cycle_seq_ctrl
set last_number = p_nextval
,reset_time = p_currtime
,prev_nextval = last_number + increment_by
where sequence_name = p_seqname
currval_tab(p_seqname) := p_nextval;
commit;
return p_nextval;
end if;
-- already reseted (in a same second)
if (p_ctrl.reset_time = p_currtime) then
p_nextval := p_ctrl.last_number + p_ctrl.increment_by;
update cycle_seq_ctrl
set last_number = p_nextval
where sequence_name = p_seqname
currval_tab(p_seqname) := p_nextval;
commit;
return p_nextval;
-- already reseted
else
p_nextval := p_ctrl.prev_nextval + p_ctrl.increment_by;
update cycle_seq_ctrl
set prev_nextval = p_nextval
where sequence_name = p_seqname
currval_tab(p_seqname) := p_nextval;
commit;
return p_nextval;
end if;
exception
when no_data_found then
raise_application_error(-20800,
'cycle_seq.seq_def('''||seq_name
||''') has not been called.');
when timeout_on_nowait or timeout_on_wait_sec then
raise_application_error(-20899,
'cycle_seq.nextvalue('''||seq_name
||''') is time out.');
when others then
raise;
end
function currvalue
(seq_name varchar2
) return integer
is
p_seqname cycle_seq_ctrl.sequence_name%type;
begin
p_seqname := upper(trim(seq_name));
return currval_tab(upper(seq_name));
exception
when no_data_found then
raise_application_error(-20802,
'cycle_seq.nextvalue('''
||seq_name||''') has not been called in this session.');
when others then
raise;
end
procedure seq_def
(seq_name varchar2
,cycleterm varchar2 := 'DD'
,incr_by integer := 1
,start_with integer := 1
,maxvalue integer := to_number('1e27')
,minvalue integer := 1
is
p_seqname cycle_seq_ctrl.sequence_name%type;
p_currtime date;
p_cycleterm cycle_seq_ctrl.cycle_term%type;
begin
p_currtime := sysdate;
p_seqname := upper(trim(seq_name));
p_cycleterm := upper(trim(cycleterm));
if (p_cycleterm<>'SS') then
p_currtime := trunc(p_currtime,cycleterm);
end if;
insert into cycle_seq_ctrl
(sequence_name
,min_value
,max_value
,increment_by
,cycle_term
,last_number
,reset_time
,prev_nextval
values
(p_seqname
,minvalue
,maxvalue
,incr_by
,p_cycleterm
,start_with - incr_by
,p_currtime
,start_with - incr_by
commit; -- Because this is as like a DDL
exception
when dup_val_on_index then
raise_application_error(-20955,
'already defined with '
||'cycle_seq.seq_def('''||seq_name||''')');
when others then
raise;
end
procedure seq_undef
(seq_name varchar2
is
p_seqname cycle_seq_ctrl.sequence_name%type;
begin
p_seqname := upper(trim(seq_name));
delete from cycle_seq_ctrl
where sequence_name = p_seqname
commit; -- Because this is as like a DDL
end
end; -- package body cycle_seq
/ -
2 iphoto libraries? and viewing all thumbnails but can't view landscape
We have 2 users set up on the computer and I have recently noticed that the iphoto libraries in each of the users/pictures folder don't seem to be the same size. Are these truly 2 different libraries based on which account our photos were imported into?
AND, my recent imports into iPhoto seems to be behaving 'funny'. I can view all the thumbnails, but, when I try to open any landscape photos, the picture flashes, and then I only see a black screen. The portrait photos in the same event are viewing without issue? Any ideas?iPhoto is based on a database. Once you import/copy the photos into the library you can add a photo to multiple items, i.e. albums, books, calendars, without having to duplicate the original image file. All management of the photo is done within iPhoto and it's database. All access to photos for use in or out of iPhoto is done from within iPhoto. There's no need to get into the library via the Finder.
The following is from one of Terence Devlin’s posts on file access for use outside of iPhoto. It’s the definitive treatise on the subject.
Since iPhoto 7 (iLife 08) the old iPhoto Library Folder is now a Package File. This is simply a folder that looks like a file in the Finder. The change was made to the format of the iPhoto library because many users were inadvertently corrupting their library by browsing through it with other software or making changes in it themselves.
Accessing the iPhoto Library Folder directly has never been supported in any version of iPhoto.
There are many, many ways to access your files in iPhoto:
For Users of 10.5 and later
You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
Uploaded with plasq's Skitch!
(Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
You can access the Library from the New Message Window in Mail:
Uploaded with plasq's Skitch!
For users of 10.4 and later ...
Many internet sites such as Flickr and SmugMug have plug-ins for accessing the iPhoto Library. If the site you want to use doesn’t then some, one or any of these will also work:
To upload to a site that does not have an iPhoto Export Plug-in the recommended way is to Select the Pic in the iPhoto Window and go File -> Export and export the pic to the desktop, then upload from there. After the upload you can trash the pic on the desktop. It's only a copy and your original is safe in iPhoto.
This is also true for emailing with Web-based services. However, if you're using Gmail you can use iPhoto2GMail
If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
If you want to access the files with iPhoto not running:
For users of 10.6 and later:
You can download a free Services component from MacOSXAutomation which will give you access to the iPhoto Library from your Services Menu. Using the Services Preference Pane you can even create a keyboard shortcut for it.
For Users of 10.4 and later:
Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
Other options include:
1. Drag and Drop: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
2. File -> Export: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
3. Show File: Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.
You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.
All of the above are a: faster and b: Safer than rooting around in the old Library Folder. -
Created PO, Delivery and GI all in one.
Hi
We need to have a process where we create Purchase Order followed by Delivery followed by the Goods Issue all in the background.
(We want to have an IDOC created based on all three of these documents u2013 and if only 1 or 2 are created the and the other fails, the IDOC is hanging and a manual intervention is needed. We want to have everything completely automated)
The thing is that we need to create them in a way that if one of them fail - non gets created. In other words u2013 if a PO and a Delivery were successful but the GI failed everything should roll back and no PO or Delivery created.
Now if you create a PO and do not commit it u2013 when you try to create a delivery in the regular way it fails because it cannot find any of the data it needs in the database.
If you do commit it u2013 you have a PO that you donu2019t want to exist if the delivery fail.
So I needed a way to make the delivery BAPI and the GI FM looked at the data in temporary tables before a commit is done.
To do this tried to use BAPIu2019s BAPI_PO_CREATE1, for the PO, BAPI_DELIVERYPROCESSING_EXEC for the Delivery, and FM SD_DELIVERY_UPDATE_PICKING for the GI.
I have put them all in a Function Module that I call in Update Task (To create the temporary tables to work from).
The problem I run into is that SD_DELIVERY_UPDATE_PICKING is using FM MB_CREATE_GOODS_MOVEMENT and that FM runs a series of checks in the end and is calling a program with a SUBMIT. (A SUBMIT cannot be used in an update task.), so the whole process does not work.
My question is u2013 whether anyone out there had try to do the same thing successfully u2013 and if yes how?
Is there a way to make it work in the UPDATE TASK FM or maybe a different way to do this altogether?
It seems like a simple process that should not be so difficult u2013 but I am running into a lot of problems trying to make it work.
Any anwers or help would be greatly appreciated.
Thanks
ElonaHi Elona,
I have the very same problem with similar BAPI-sequence. I need to create Purchase Order and after it Goods Movement.
Have you solved that issue somehow ? I'll be very grateful for every help or tip.
Thanks in advance -
Creating a function and return something from an XML file
Hi!
I'm working with timeline actionscript. I want to create a function that loads my xmlfile and returns an xmlobject with the file's content.
This is what I got so far:
my_btn.addEventListener(MouseEvent.CLICK, getXML("myxml.xml")); //1067: Implicit coercion of a value of type void to an unrelated type Function.
function getXML(fn:String):void{
var infoLoader:URLLoader = new URLLoader();
infoLoader.addEventListener(Event.COMPLETE, xmlLoaded);
infoLoader.load(new URLRequest(fn));
var myXML:XML = xmlLoaded(); //1136: Incorrect number of arguments. Expected 1.
trace(myXML);
function xmlLoaded(e:Event):XML{
return e.target.data;
//trace(e.target.data);
Can anyone take a look and perhaps point me in the right direction?
ThanksI have never used a listcomponent, so I can only help with the steps before filling it with data.
I think you should at start of your application load the XML with filenames and just after it's completed, e.g. in Event.COMPLETE handler, load all other XMLs looping through filenamesXML, like this
var filenamesXML:XML;
var XMLsToLoad:uint = 0;
function filenamesXMLLoaded(e:Event):void
filenamesXML = XML(e.target.data);
XMLsToLoad = filenamesXML.filenames.children().length();
for (var i:uint =1; i < filenamesXML.filenames.children().length(); i++)
getXML( filenamesXML.filenames.children()[i] ); // the function from my previous post, don't forget to implement it
//modify the minor xml load handler from the previous post
function xmlLoaded(e:Event):void
var loadedXML:XML = XML(e.target.data);
xmlArray.push(loadedXML);
XMLsToLoad--;
//assign the one click handler to all buttons, a loop here would be quite handy
function clickHandler(e:MouseEvent):void
if (XMLsToLoad == 0) //check if all xmls have been completely loaded
switch (e.target.name) // swith by clicked button's instance name
case "button_1":
// here you have to implement supplying listcomponent with data, I think a loop again will be a good idea
break;
case "button_2":
// ibid.
break;
Regards,
gc -
Creating New Functions and Risks in RAR 5.3
All,
I need to create a set of new functions and risks in RAR 5.3. What is the best way to do this?
I tried to export existing functions and modify what I thought were the relevant tables. Next I tried to import this into Rule Architect > Utilities > Import Rules. I got the confirmation the import uploaded successfully and a rule generation job started. The job took a while and when it comepleted I looked for the functions and they weren't there. What do you all advise?
Thanks,
Grace Raeyes Frank is right. if few functions then better do with Rule Architect
else you must understand interdependency of various table
did you defined which Business Process thsoe function will belong to.......
check table
VIRSA_CC_BUSPRC
VIRSA_CC_BUSPRCT
VIRSA_CC_FUNC
VIRSA_CC_FUNCT
virsa_cc_func*
functions and the object they pulled and actions , all these interrelations should be taken care of.....
better refer to default rule sets send by SAP, that's the way you have to create.....
regards,
Surpreet -
I am currently enrolled in online classes and I have to have Microsoft Office to access Word, Excel, Powerpoint for the classes. I have a laptop and an iPad2 but do not have Microsoft Office on either. Rather than purchase it on windows, I wanted to see if there is an app to be able to Create a new document for Word, edit, save and view those as well. And for Powerpoint and Excel. We have Documents to Go Premium currently installed on the iPad but I can't figure out how to create a new document or even how to save or view a document I'm trying to access through the class online. Thanks in advance for the help!!
I don't have the premium version but I do the regular version. to create a new document open the program and go into either your desktop or local files and there'll be alittle sheet of paper with a plus sign on it in the lower right corner. That makes a new document.
Dunno if it's still a glitch or not, but some reported not being able to type with a blue tooth keyboard in an empty document. The solution to that is to turn off hte bluetooth, type in a few letters with the onscreen, then to turn the bluetooth back on.
as to saving a document from online, that'd depend on what kind it is and how you can download. -
HELP! multiple email addresses, need to consolidate and forward all at once
1. I have 2 email addresses and would like to have only one. I tried to cancel my old email account, but apparently it is still open
2. If I do have 2 email accounts, I would like to cancel it and make sure that I'm not paying for 2 accounts
3. In this process, I have tried forwarding all of my important emails from my old email to my new one, but I'm unable to select all of them at once and forward them together. Is there a way that I can forward all of them at the same time without having to go through the time consuming process of doing them one by one?
Thanks,
glb1968Can someone help me? I have a hundred or so emails to forward to me new address, and I really would like to avoid having to send them one by one. Does anyone know how to select all of them and send them at once?
-
How to hide Recycling bin and View All Site Content
Is there a way to hide the "View All Site Content" and the "Recycling Bin" without modifying with S Designer.
ThanksHiding these links with CSS is a "band-aid" fix. Users are still downloading the HTML for these controls, and users that don't use CSS will still see them in their entirety. The best option is to remove them from your site's master page entirely.
First, look for the following lines of code in your master page. This code renders the "View All Site Content" link:
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
<div class="ms-quicklaunchheader"><SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
</SharePoint:SPSecurityTrimmedControl>
Now, the "Recycle Bin" link should look something like this:
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" id="idNavLinkRecycleBin" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems"/>
Now save, check in, and publish your changes. I hope this helps!
Kyle
Maybe you are looking for
-
Report to check CAT5 & CAT7 Transferred or Not
Dear All, Time Tickets are booked on WBS /Network & Activity thorough CATS. When we Executed CAT5/CAT7 , we get an Error Log that Time Tickets are not transferred because of Budget Error. We do have a Report CATS_DA to check the Time Ticket Booked.
-
Slow Boot-Up with 3 monitors after Yosemite
I updated my Mac Pro 12-Core (40GB RAM) last week to Yosemite. Since then, my Mac takes about 15 minutes to boot up after either a fresh start or Restart. If I remove 1 of my 3 monitors, I get a normal boot (I have an SSD startup drive, so it takes a
-
Is there an easy way to create or import tables into muse
I'm trying to create a website that used tables for things like league tables and results, but I need an easy way of placing them into muse. I've had a go at creating tables in dreamweaver and importing the resulting html and i've created tables in I
-
Hi , I've installed and set officewebapps. word (view and edit) working great. But I'm having problems also excel. http://.../_layouts/15/WopiFrame.aspx?sourcedoc=/...xlsx&action=edit or http://.../_layouts/15/WopiFrame.aspx?sourcedoc=/...xlsx&
-
Trying to export to Snapfish. Keep getting: Network error.
You are not connected to the internet. Please connect to the internet and try again. However, I am connect to the internet (safari is fine)